草庐IT

undefined-reference

全部标签

PHP - undefined offset : 0

print_r($p->attachments)产生:Array([0]=>stdClassObject([id]=>...[url]=>http://...png[slug]=>...[title]=>...[description]=>...[caption]=>...[parent]=>...[mime_type]=>image/png[images]=>...()))我想访问url字段中的值print_r($p->attachments[0]->url)检索url,但也产生:Undefinedoffset:0现在我可以通过调用print_r(@$p->attachments[0

php - 如何在 PHP 脚本中查找 undefined variable

假设我们在PHP中有以下函数:publicfunctiontestSomething(){$name=perform_sql_query("SELECTnameFROMtableWHEREid=$entity_id;");assert($name=="some_name");}查询在语法上是正确的,但由于$entity_id未定义-查询将始终搜索“id=0”,这在语义上是不正确的。我希望这样的函数在尝试使用undefinedvariable时自动失败。PHP中有这样的机制吗?或者也许有一些工具可以用来分析PHP源代码以找到此类情况?那些undefinedvariable可以出现在项目的

php - fatal error : Call to undefined function add_action()

我有一些推特更新的代码-functiontwitit(){global$wp_query;$thePostName=$wp_query->post->post_name;echo'ID).'"title="ClicktosendthispagetoTwitter!"target="_blank">ShareonTwitter';}functionwidget_twitit($args){extract($args);echo$before_widget;echo$before_title;echo$after_title;twitit();echo$after_widget;}func

php - $_POST 不工作。 "Notice: Undefined index: username..."

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:PHP:“Notice:Undefinedvariable”and“Notice:Undefinedindex”所以,我目前正在学习PHP,并且正在阅读一本关于密码md5函数的书,所以我决定尝试一下,看看效果如何。我还决定使用POST方法而不是GET,因为我看到有人说它更安全并且不会让变量出现在URL上。对于我的测试项目,我制作了一个非常简单的表格,如下所示:Username:Password:问题是,当我在两个字段中输入值并单击“登录”时,我在另一个PHP文件中得到以下输出。Notice:Undefinedi

phpMyAdmin fatal error : Call to undefined function __()

运行RHEL7和PHP5.4.16的服务器。当我尝试在浏览器中打开/phpMyAdmin时,出现错误:fatalerror:调用/usr/share/phpMyAdmin/libraries/core.lib.php中的未定义函数__()第242行CallStack#TimeMemoryFunctionLocation10.0008348000{main}()../index.php:020.0018503144require_once('/usr/share/phpMyAdmin/libraries/common.inc.php')../index.php:1230.02524224

php - Notice : Undefined Index. 如何定义索引?

我收到了回复:Notice:UndefinedindexyyinPage1.phponline11Notice:UndefinedindexmminPage1.phponline12Notice:UndefinedindexddinPage1.phponline13如何定义这些yy、mm、dd?2001//...Another100years12//...another10months12//...another29days 最佳答案 尝试将这些post变量包装在isset中功能:$_SESSION['yy']=isset($_PO

php - Magento 将 referer 参数添加到 getLoginPostUrl()

我正在尝试创建一个尽可能无缝地将登录集成到流程中的表单。我目前正在使用Mage::helper('customer')->getLoginPostUrl()作为登录表单,如果有更好的使用方法我会洗耳恭听,并且它有效,但它最终出现在用户仪表板上。我查找了函数及其寻找if($this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)){但我不确定如何以函数读取它的方式给它参数。我注意到如果我使用Mage::helper('customer')->getLoginUrl()它会添加referer本身,所以我跟踪它并发现它是如何将

php - 结束( explode )严格标准 : Only variables should be passed by reference in

我有这段代码来获取文件的扩展名:$extension=end(explode(".",$_FILES["rfile"]["name"]));这在本地主机上工作正常,但是当我上传在线托管时,它给了我这个错误:StrictStandards:Onlyvariablesshouldbepassedbyreferencein... 最佳答案 为什么不使用pathinfo(PHP>=4.0.3),即:$ext=pathinfo($_FILES["rfile"]["name"])['extension'];现场PHP演示http://ideon

php - 如何避免 undefined index

如何轻松避免在PHP中收到此错误/通知?Notice:Undefinedindex:testin/var/www/page.phponline21代码:$table='test';$preset=array();method($preset[$table]);数组$preset存在但不具有指定的索引 最佳答案 使用array_key_exists检查它是否存在:$table='test';$preset=array();if(array_key_exists($table,$preset)){method($preset[$tabl

php - fatal error : Call to undefined function mcrypt_get_block_size()

我正在将我的网站上传到服务器,并且上传成功。之后,当我运行时,它给了我这个错误:Fatalerror:Calltoundefinedfunctionmcrypt_get_block_size().我还检查了我的PHP我服务器上的版本是5.3.14。我不知道该如何处理。我将此函数用于查询字符串加密。我在谷歌上搜索了这个,有人说你必须让你的主机安装它。是否有另一种方法来安装这个或替代函数,就像这个mcrypt_get_block_size()一样工作? 最佳答案 您必须安装并启用mcrypt.在Debian上基于Linux发行版(如Ub