草庐IT

something_undefined

全部标签

php - 在 CakePHP 2.0 中使用 Html Helper 时 undefined variable

我在第一次尝试CakePHP时收到此错误:Undefinedvariable:html[APP/View/Posts/index.ctp,line13]我有2.0-alpha版,是我弄错了版本还是又发生了什么变化。似乎找不到html助手。根据要求提供更多信息:这里是index.ctp文件link($post['Post']['title'],array('controller'=>'posts','action'=>'view',$post['Post']['id']));?>数据肯定会通过,但我得到的错误是第13行:Undefinedvariable:html[APP/View/Po

php - ftp_connect fatal error : call undefined function

出于某种原因,ftp_connect()函数不起作用,当我尝试使用它时,它以fatalerror结束,指出此函数未定义...令人惊讶的是我仍然可以使用ftp客户端或使用ftp连接通过终端。我该如何解决这个问题?我在MountainLion上运行,我有5.3php版本-我重新安装了一次,希望这能解决我的问题。 最佳答案 检查PHPFTPinstallationmanual在PHP7上,您可以通过将此行添加到php.ini文件来启用它。extension=php_ftp.dll在PHP8+上启用php.ini中的这一行:extensio

php - 数据表页脚错误 : Uncaught TypeError: Cannot set property 'nTf' of undefined

我面临与数据表相关的问题。我有大量记录(45,000+)。所以我使用带有“服务器端”编码的数据表。问题是这样的,它在下面的代码中显示以下错误是:错误:UncaughtTypeError:Cannotsetproperty'nTf'ofundefined//allowscellstobeusedformultiplecolumnsusingcolspanif(tfoot!==null){varcells=oSettings.aoFooter[0];for(i=0,ien=cells.length;i我为此使用的JavaScript代码是:$(document).ready(functio

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 - "example@something.com"-> "example"PHP

我对正则表达式还很陌生,无法真正弄清楚它是如何工作的。我试过这个:functionchange_email($email){returnpreg_match('/^[\w]$/',$email);}但这只返回bool值true或false,我希望它返回@之前的所有内容。这可能吗?我什至不认为我在这里使用了正确的php函数.. 最佳答案 使用explode尝试更简单的方法:explode('@',$email)[0]; 关于php-"example@something.com"->"exa