草庐IT

directory-walk

全部标签

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

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

php 5.3 转换 array_walk_recursive

我有以下代码,我想摆脱调用时间传递引用,(从5.2转换为5.3)但我不确定正确的方法是什么这将是(类,全局变量,?)这是一个应该包含所有内容的键盘http://codepad.org/ombgFPMR1,101=>1,102=>array(106=>1,107=>1),103=>1,104=>1,105=>array(108=>1,109=>array(110=>1,111=>1,112=>1)));foreach($countsas$key=>$count){$total=0;if(is_array($count)){$total++;/*Thebelowisalogicerror.

php - 我们怎么能在 array_walk 中得到错误的返回呢?

在这种情况下,我们将在array_walk()中返回false。事实上,他们在官方文档中说:ReturnsTRUEonsuccessorFALSEonfailure.甚至,如果我测试:$array=[];var_dump(array_walk($array,function($val){return$val;}));//bool(true) 最佳答案 似乎这个函数总是返回true。即使它会生成警告,它仍然会返回true。考虑以下代码:$array=[1,2,3];//Warning:array_walk():Iteratedvalu

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 - Wordpress walker 调用父 walk() 方法

当扩展Walker基类时,我需要扩展walk()方法。但是,调用父级walk()方法不会产生任何结果。这些是我尝试过的方法:publicfunctionwalk($elements,$max_depth){parent::walk($elements,$max_depth);}publicfunctionwalk($elements,$max_depth){$parent_class=get_parent_class($this);$args=array($elements,$max_depth);call_user_func_array(array($parent_class,'wa

php - file_get_contents() 无法打开流 : No such file or directory

我正在编写一些php脚本来更新我网站上的代码。为了做到这一点,我编写了以下行来检查更新版本,并从我用来分发更新的地方获取名称,然后创建该名称的链接。我做过这样的事情。$filename="http://www.hf-live.com/codeupdate/Get_Files_Name.php";$contents=file_get_contents($filename);echo$contents;我收到这个错误failedtoopenstream:Nosuchfileordirectory.即使文件存在,我仍然遇到同样的错误。我已将allow_url_fopen开启为on。上面的代码

php - 使用 sudo : Registry directory is still not writeable by the current user. 为什么?

我正在尝试运行:sudopeclchannel-updatepecl.php.net因为每次我尝试安装一个包时,它都会提示我运行它。但是,当我运行这些命令时,我得到:“当前用户无法写入注册表目录”现在thisquestion非常相似,但建议使用sudo我已经在做。当我运行sudowhoami时,我得到了root。这可能与http://pear.php.net有关吗?下降? 最佳答案 我遇到了完全相同的问题(在我的MacBook上),我是这样解决的:我使用以下步骤重新安装了PEAR:http://jason.pureconcepts.

PHP header (位置 :) redirect with root directory

有没有办法创建从根目录开始的header('Location:');路径。例如:formaction="/cert/forms/sessions/session-inc-info.php"或include($_SERVER['DOCUMENT_ROOT'].'/cert/forms/sessions/session-inc-info.php');cert是我的根目录文件夹我一直在尝试这样的代码header('Location:'.$_SERVER['DOCUMENT_ROOT'].'/cert/forms/sessions/session-inc-info.php);和header('

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn