草庐IT

something_undefined

全部标签

PHP preg_replace : How can I match something but not replace it?

例如,如果我想preg_replace一个HTML元素的标题:$str=preg_replace('/title=\"([^\"]+)\"/','foo',$str);请不要为这个特定示例提供其他解决方案(非正则表达式),这只是一个示例。我需要一个适用于任何正则表达式的解决方案。 最佳答案 如果你想用preg_replace匹配部分,但只是部分替换其他东西,那么有两种选择。您可以重新插入匹配的部分(包含在捕获组中,然后使用$1和$3):$str=preg_replace('/(title=")([^"]+)(")/','$1foo$

PHP: "Call to undefined method"... 但方法已定义?

我有一个Database.php类,它是一个抽象的Singleton类:其他数据库扩展了这个类并实现了抽象函数,这样我就可以改变我使用的数据库,同时确保我的应用程序仍然可以工作,只要它使用这个抽象层中的函数(我已经省略了函数定义来自上面的代码)。我在PDO.php中有一个PDO类。它扩展了数据库,还包括与上面相同的instance()函数,但它没有自己的$_instance变量。classPDOextendsDatabase{//...publicstaticfunctioninstance(){$class=get_called_class();if(!self::$_instanc

php - 为什么我在 Laravel View 中得到 "Undefined variable"?

当我尝试从类别所在的表中获取数据时,出现undefinedvariable:类别错误。$posts变量工作正常。@if(count($posts))@foreach($postsas$post)@if($post->category)category->name}}isotope-item">{{$post->updated_at}}{{Str::words($post->title,3)}}{{Str::words($post->body,60)}}{{HTML::linkRoute('posts.show','Readmore',array($post->id))}}@endif@

php - codeigniter 上的错误 undefined variable 替代

我在我的View文件中发现了这种错误类型,如下所示。请帮我解决这个错误。我很高兴能解决这个问题。我在等待正确答案遇到PHP错误严重性:通知消息:undefinedvariable:备选文件名:views/all_investor_relation.php行号:47$value){$paths=base_url().'uploads/investor_relation/';$image=$value['docpath'];$title=$value['title'];$imageso="$title";$content="".$i."".$imageso."}echo$content;}

javascript - 选择 2 类型错误 : b is undefined

我正在使用select2在下拉列表中显示ajax结果,但是当我将数据附加到select2时,它显示错误TypeError:bisundefinedJS代码varbaseurl=$("#baseurl").val();$(".myselect").select2({placeholder:"Selectainspector",allowClear:true,ajax:{url:baseurl+'/admin/getdata',dataType:'json',type:"GET",quietMillis:50,data:function(term){return{term:term.ter

php - Laravel undefined variable $articles

我正忙于我自己的新闻系统,我正在使用Laravel5。我对Laravel很陌生,并且使用教程来逐步了解它。现在我遇到了这个错误“undefinedvariable:文章”。这是我的ArticlesController.php这是我的news.blade.php@foreach($articlesas$article){{$article->title}}5December JohnDoe Category,Category 5Comments{{$article->body}}ReadMore@endforeach我已经尝试了一些事情,例如删除所有内容并重

php - 我该如何解决这个 undefined index 错误? Jquery Ajax 到 PHP

我正在使用Jquery、Ajax和PHP尝试发送要写入mysql数据库的变量。正在发出Ajax请求,但php.ini未获取变量。我不知道为什么会这样。使用firebug和console.log()我可以看到已经对write_results.php进行了POST如果我检查它说的Response注意:E:\write_results.php中2未定义索引:testscore这是我的PHP这是我的ajax脚本$(document).ready(function(){testscore="tryagain";//testvaluetoenterintothemysqldatabase$.aja

php - 这个 if 语句的含义 [if (condition) : something; endif;]

我今天一直在阅读一些joomla代码,我经常遇到如下语句:item->modified)!=0&&$this->item->params->get('show_modify_date')):?>item->modified,JText::_('DATE_FORMAT_LC2')));?>按照我的阅读方式,它似乎转换为以下语法:if(condition)://dosomethinghereendif;我不熟悉这种语法(:在if语句之后)。谁能指出我正确的位置? 最佳答案 检查这个Alternativesyntaxforcontrols

php - 获取 undefined variable : PHP_SELF

这是我从网站下载的应用程序代码,但它显示在错误日志中GettingUndefinedvariable:PHP_SELFonline150,inindex.php,现在第150行是"method="GET">这是表单的完整代码"method="GET">"name=p1>"name=p2> 最佳答案 它应该是$_SERVER变量中的索引:"...>当然,除非你定义它:$PHP_SELF=$_SERVER['PHP_SELF'];或者,您也可以省略它,因为您的目的是在当前页面中提交表单: 关

php - undefined offset PHP,不确定它的作用

这个问题在这里已经有了答案:"Notice:Undefinedvariable","Notice:Undefinedindex","Warning:Undefinedarraykey",and"Notice:Undefinedoffset"usingPHP(29个答案)关闭6个月前。我在PHPerror.log中有以下错误[TueDec1912:08:22.8875742017][:error][pid32196][clientxx.xx.xx.x:20560]PHPNotice:Undefinedoffset:8in/var/www/html/page.phponline55,ref