草庐IT

get_default_session

全部标签

php - 使用 session PHP 将登录详细信息传递到另一个页面

我需要另一个页面中的登录详细信息来从数据库中检索数据。基本上,我需要显示包含登录用户详细信息的可编辑表单。我尝试使用session_register()将用户名存储在login.php页面中。但出于某种原因,我无法在我的edit.php页面中使用$_SESSION[]显示用户名。我也在函数session_start()之后执行此操作。我是php新手,不知道是不是我对session的理解有误!或者有没有其他方法可以传递登录详细信息?提前致谢我的代码:**Login.php**Re-EnterUserNameandPassword';}?>**Inedit.php**

php - ZF2 : how to get options for dropdown from db

我关注了tutorial.但是我找不到像这样从数据库中选择填充表单的方法://Blog/src/Blog/Form/BlogItemForm.php$blogCategoryTable=newModel\BlogCategoryTable;$this->add(newElement\Select('category_id',array('label'=>'Category','value_options'=>$blogCategoryTable->getFormChoices())));有没有人有什么想法? 最佳答案 我使用一个函数

php - 如何将 $_GET 路径与 file_exists 一起使用并保证其安全?

我有一个函数可以通过jQuery检查文件是否存在,它会调用PHP脚本,我将在单击索引页上的按钮更改某些图像时使用该脚本。jQuery函数:functionfileExists(path){$.getJSON("/ajax/fileExists.php",{path:path},function(data){returndata.path;});}文件存在.php:$path=$_SERVER['DOCUMENT_ROOT'].'/packs'.$_GET['path'];if(file_exists($path)){echojson_encode(TRUE);}else{echojso

php - session_start() 在 mac 上不工作

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:HowcanIfixthePermissionerrorwhenIcallsession_start()?PHPWarningPermissiondenied(13)onsession_start()我正在尝试制作一个管理面板。不幸的是,session在macbook上不起作用。我已经安装并运行了所有东西,此时还有最新的php。我只是无法让它在我的Mac上运行。它确实适用于我的付费主机,但我无法使用它。请帮我解决这个问题。我相信这与许可写作有关。

php - CakePHP facebook注销 session 没有破坏

我正在使用cakephp2.1并使用来自https://github.com/webtechnick/CakePHP-Facebook-Plugin我正在使用如下的facebook登录助手$this->facebook->login(array('redirect'=>'facebook_login','label'=>'signinviafacebook','id'=>'fb-login')).和注销助手如下$this->Facebook->logout(array('redirect'=>array('controller'=>'users','action'=>'logout')

当在类中定义魔术方法 __get 和 __set 时,PHP 函数 Empty 不起作用

目前我在YII框架中工作,我在其中创建了一个扩展CFormModel的类,在该类中,我覆盖了以下函数:publicfunction__get($name)publicfunction__set($name,$value)我已进行以下检查以确保end_date和start_date不为空if(!empty($this->end_date)AND!empty($this->start_date)){**/*NotWorking*/**/*SomeApplicationLogic*/}但是它不能正常工作并且条件不满足。当我调试代码时,我开始知道$this->start_date和$this-

PHP session 变量不会被取消设置

我在Drupal模块中有几行代码:if($arg=='true'&&isset($_SESSION['xyz']['noredirect'])){unset($_SESSION['xyz']['noredirect']);}当执行第二行时,出现错误:ErrormessageNotice:Undefinedvariable:_SESSIONinblah()(line122of/home/xxxxxxx/public_html/sites/all/modules/blah/blah.module).我根本无法理解为什么如果设置了session,我就无法取消设置。有什么想法吗?谢谢

PHP/AJAX 并发 session 仅在 Chrome 中行为不端

长话短说;博士。有趣的部分无需先浏览JS:我正在递增session计数器,但不同的请求看到相同的值。这只是Chrome中的一个问题。在Firefox和InternetExplorer中,每个请求都会看到一个唯一的值。我尝试多次访问网页(以处理数据),直到获得204HTTP代码。我可以一次进行一个ajax调用,方法是让ajax在成功时调用自身,并在204停止。因为我想更快地完成它们,所以我在js中有多个“线程”都在这样做。我的意思是创建了多个相同的ajax调用,并且它们在完成后都会启动另一个调用,并在204代码处停止。我的相关js如下所示:$(function(){//"thread"i

php - 代码点火器 2 : getting 404 error on default controller

我这样设置默认Controller$route['default_controller']="InterviewController";这是InterviewController的代码classInterviewControllerextendsCI_Controller{private$em;function__construct(){parent::__construct();}publicfunctionindex(){$commentsList=array();$commentsList['comments']=$this->em->getRepository('Entitie

php - 警告 : get_class() expects parameter 1 to be object

一周前我写了一个代码,它运行良好。但是今天当我检查它时,它给了我一些问题,比如Warning:get_class()expectsparameter1tobeobject,arraygivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparameter1tobeobject,stringgivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparame