草庐IT

parent_directory

全部标签

php - 运行时异常 : Unable to guess the Kernel directory

我正在使用Symfony3.4。突然,每当我尝试在/tests中运行我的测试(phpunit)时,我都会收到以下错误:RuntimeException:UnabletoguesstheKerneldirectory.我的测试类看起来像:classPaymentCreditTestextendsKernelTestCase{/**@varPaymentRepository*/public$paymentRepository;/***{@inheritDoc}*/protectedfunctionsetUp(){$this->paymentRepository=self::bootKern

php - parent 是否可以从静态方法内部使用 child 的常量或静态变量?

下面是我正在尝试做的一个例子。parent无法访问child的任何变量。不管我使用什么技术(静态或常量),我只需要像这样的某种功能。classParentClass{publicstaticfunctionstaticFunc(){//bothofthesewillthrowa(static|const)notdefinederrorechoself::$myStatic;echoself::MY_CONSTANT;}}classChildClassextendsParentClass{constMY_CONSTANT=1;publicstatic$myStatic=2;}ChildC

PHP 继承 : child class overriding parent variable/property for use in constructor

我有一个(抽象的)父类应该在构造期间提供功能。子类可以覆盖构造函数中使用的属性:classParentextendsMiddlewareTest{//abstractchannelpropertiesprotected$title=NULL;protected$type=NULL;protected$resolution=NULL;function__construct(){parent::__construct();$this->uuid=$this->createChannel($this->title,$this->type,$this->resolution);}}classC

PHP 面向对象 : Get all declared classes which are have extended another parent class

我需要获取所有扩展了另一个父类的声明类。例如……classParentClass{}classChildOneextendsParentClass{}classChildTwoextendsParentClass{}classChildThree{}我需要一个输出这个的数组:array('ChildOne','ChildTwo')我是PHPOOP的新手,但基于一些谷歌搜索,我想到了这个解决方案。$classes=array();foreach(get_declared_classes()as$class){if(is_subclass_of($class,'ParentClass'))

php - 覆盖 php 中的祖 parent 方法

我目前正在为一个应用程序编写一组骨架类,从一个名为StoreLogic的基类开始,它包含税收规则、折扣规则等。Cart、Order、Quote等类将扩展StoreLogic,因为它们将都使用StoreLogic提供的同一组方法。完成这些核心类后,我将通过扩展Cart、Order、Quote和StoreLogic来实现它们,因为这些类的每个应用程序将根据我们不同的客户需求而有所不同。从父类覆盖方法很容易,但是在他们的child扩展它们之前覆盖祖parent类似乎......不可能?我觉得我这样做的方式是错误的(t​​m)..而且我认为像您这样更有经验的人可能会为我指明正确的方向。看看代码

php - 文件存在于/tmp,但 PHP 在 CentOS 上返回 "No such file or directory"

在PHP中,我收到此消息:警告:fopen(/tmp/mydir/file.txt):无法打开流:没有此类文件或目录调用fopen时('/tmp/mydir/file.txt',"r");但是:cd/tmpls-l.drwxrwxr-x2user4.0KAug1914:09mydirls-lmydir-rw-rw-r--1user41KAug1914:09file.txt如果我尝试执行print_r(scandir('/tmp/'));我得到一个空数组。执行print_r(scandir('/tmp/mydir/'));我得到无法打开目录:没有这样的文件或目录。然而,执行print_r

php - (Docker) 收到错误 : docker-php-source: no such file or directory when building docker file

当我尝试构建docker文件时:https://github.com/docker-library/php/blob/3f43309a0d5a427f54dc885e0812068ee767c03e/7.1/Dockerfile命令:dockerbuild-tphp_image.我遇到了以下错误:Step14:COPYdocker-php-source/usr/local/bin/lstatdocker-php-source:nosuchfileordirectory谁能帮我找出问题所在?谢谢 最佳答案 您没有正确的dockerbu

php - 臭名昭著的 Apache 错误 "Parent: child process exited with status 3221225477"

我已经阅读了一些与臭名昭著的Apache错误相关的问题和回复Apacheerror[notice]Parent:childprocessexitedwithstatus3221225477—Restarting但到目前为止,没有什么可以帮助我。我想问你的是,如果我使用Linux版本,脚本会不会因为同样的原因导致Apache崩溃?顺便说一下,如果有人对我的案例有任何建议,这里是Apache的error.log[MonAug0814:31:442011][notice]Parent:childprocessexitedwithstatus3221225477--Restarting.[Mo

php - 是否将大量参数传递给 parent::__construct 代码异味/糟糕的 OOP?

我正在写一些代码,我开始对凌乱的parent::__construct调用感到有点不舒服,我想知道首先它是不是糟糕的OOP实践,其次是否有更简洁的方法来做到这一点?请参阅下面触发我问题的特别极端的示例。setBrowseNodeId($BrowseNodeId);}protectedfunctionsetBrowseNodeId($BrowseNodeId){if(is_string($BrowseNodeId)){$this->BrowseNodeId=$BrowseNodeId;}else{thrownewException('BrowseNodeLookupRequestPara

php - Laravel Blade : Getting access to a variable in a nested partial from a parent view

我的父View是这样的:show.blade.php@include('inquiries.partials.inquiries')它使用以下部分:查询.blade.php@foreach($inquiryas$key=>$item)@include('inquiries.partials.inquiry')@endforeach其中使用了另一个部分:查询.blade.php...@yield('inquiry.toolbar','')在show.blade.php中,我想为inquiry.blade.php定义inquiry.toolbar部分,但是我需要访问inquiries.bl