草庐IT

undefined-reference

全部标签

php - Laravel 队列作业失败说 Undefined property 但作业在没有队列的情况下运行正常?

我正在处理一个队列作业,它从其他API导入一些数据并存储它们。在我的Controller中,当我说$this->dispatchNow(newImportPatentsJob($numbers,$count,$invention_id,$redisId));时,它工作正常并且流程通过没有失败。但是当我将其更改为dispatch并将作业排队,然后通过队列工作程序运行它时,它失败了。我的工作看起来像:protected$numbers;protected$count;protected$invention_id;protected$redisId;/***Createanewjobinst

php - 在 composer 文件中, "reference"指的是什么?

在我的composer.lock文件中,我注意到一些包有一个reference值:"dist":{"type":"zip","url":"https://ftp.drupal.org/files/projects/paragraphs-8.x-1.1.zip","reference":"8.x-1.1","shasum":"c678e5704a98c6a0549e415412da081cfeb03a00"},有些只有null:"dist":{"type":"zip","url":"https://ftp.drupal.org/files/projects/redirect-8.x-1.

PhpUnit 模拟 : function undefined

我正在为我的View助手编写一些测试。这是我第一次想用模拟对象做点什么。我正在使用默认的PHPUnit模拟框架。我已经编写了一个函数来准备我的模拟对象:privatefunctiongetTestStub(){$mockResult=array();$mock=$this->getMock('My\Entity\Product');$mock->expects($this->once())->method('getId')->will($this->returnValue(1));$mock->expects($this->once())->method('getName')->wil

php - 处理 undefined variable

我有这个索引函数,其中包含变量$product、$categories、$most_views、$show,$check,$checkforid。publicfunctionindex(){$products=Product::where(['status'=>'1'])->orderBy('most_viewed','desc')->with('category')->get();$categories=Category::all();$mostviews=Product::where(['status'=>'Onsale'])->orderBy('most_viewed','des

php - 在 Laravel Dusk 测试中模拟 HTTP_REFERER?

有没有一种直接的方法可以在Dusk测试中模拟HTTP_REFERER?我正在使用Laravel\Dusk\Browser并在各个页面上调用visit()方法。这是使用Selenium驱动程序。类似于下面的setReferer:namespaceExample\Tests\Browser\Processes\PublicSite;classSampleBrowserextendsBrowser{useMakesAssertions,ProvidesAdditionalBrowserActions,WaitsForElements;publicfunction__construct(Rem

PHP:从父级调用静态方法时出现 "Call to undefined method"错误

如果两者都是静态的,从父类调用子类方法的正确方法是什么?当我使用静态类时它返回错误“调用未定义的方法A::multi()”,但是当我使用非静态方法时没有问题,例如://--------------STATIC------------------classA{publicstaticfunctioncalc($a,$b){returnself::multi($a,$b);}}classBextendsA{publicstaticfunctionmulti($a,$b){return$a*$b;}}echoB::calc(3,4);//ERROR!!//--------------NON-

php - XMLHttpRequest 在 IE9 中总是返回 undefined

我想知道为什么这段代码适用于firefox、chrome和IE10,但不适用于IE9varajaxReq=newXMLHttpRequest();varparams="name="+$('#name').val()varurl="register.php";ajaxReq.open("POST",url,true);ajaxReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");ajaxReq.setRequestHeader("Content-length",params.length);aja

PHP 错误 : Undefined offset: 1

这似乎是处理数组的错误,但我无法弄清楚。我真的刚刚开始使用PHP,这有点令人生畏。任何帮助将不胜感激!这是我的代码:ChooseaPoll!";$read=file('poll_topics.txt');$data=array();foreach($readas$lines){list($key,$v)=explode("|","$lines");$data[$key]=$v;}foreach($dataas$k=>$desc){echo"$k-$desc";}?>这是文本文件中的内容:Instruments|Whatkindofinstrumentsdoyoulike?Music|W

php - 为什么我收到此错误通知 : Undefined index: host

我的示例代码在这里include'simple_html_dom.php';functionget_all_links($url){global$host;$html=newsimple_html_dom();$html->load(file_get_contents($url));foreach($html->find('a')as$a){$host1=parse_url($a->href);$host=parse_url($url);if($host1['host']==$host['host']){$data[]=$a->href;}}return$data;}$links=ge

php - Symfony2 - 通知 : Undefined offset: 0 due to a custom Query

我有这个错误:"Notice:Undefinedoffset:0inC:\wamp\www\Videotheque\vendor\doctrine\lib\Doctrine\ORM\QueryBuilder.phpline240"我正在创建一个在线视频集。有2个实体:电影和流派。在我的GenRepository方法中,我尝试将函数findAll()重新定义为与某个流派相关联的电影数量。这是函数:publicfunctionmyFindAll(){$genres=$this->_em->createQueryBuilder('g')//leftJoinbecauseIneedallthe