草庐IT

is_derived_from_Wrap

全部标签

php curl 错误 : Failure when receiving data from the peer

我有一个基本的Curl脚本,它基本上在远程服务器上执行脚本。从大约6个月开始,我工作正常。昨天它停止工作,并返回以下错误。Curlerror:Failurewhenreceivingdatafromthepeer想知道是否有人知道curl在什么情况下会返回这样的错误? 最佳答案 当处理curl问题时,再次运行它:curl_setopt($ch,CURLOPT_VERBOSE,true);curl_setopt($ch,CURLOPT_STDERR,fopen('php://output','w'));通常准确的错误信息在某处。已修复

php - is_int 为 "-10"之类的负值返回 false ?

对于负数,php的is_int函数返回false是因为php中的整数是无符号的,还是我遗漏了其他行为?我正在尝试检查某些东西是否是整数,如果它正在做不同的事情,我不想依赖is_int的行为(对于测试的第一部分)。澄清:我知道is_int对负数返回false,但我想问为什么因为这种行为:var_dump(intval("-10"))打印int(-10),var_dump(intval("10"))打印int(1),因此负值和正值都被视为整数,但is_int("-10")返回false。编辑:好的,对不起大家,我对is_int和一般整数的行为有点困惑。当我需要的是字符串上的is_numer

PHP Twig : access current template variable from within macro without passing?

是否可以从宏中访问当前模板的变量而不直接将变量传递给宏?谢谢。 最佳答案 可以将所有上下文变量传递给宏:{{macro(_context)}}_context是specialvariable,其中包含所有当前定义的变量(按名称=>值)。 关于PHPTwig:accesscurrenttemplatevariablefromwithinmacrowithoutpassing?,我们在StackOverflow上找到一个类似的问题: https://stackov

PHP 反射 : How to know if a ReflectionMethod is inherited?

在ReflectionMethoddocumentation,我找不到任何信息可以知道某个方法是从其父类继承的还是在反射类中定义的。编辑:我使用ReflectionClass::getMethods().我想知道每个方法是在被反射(reflect)的类中定义的,还是在父类中定义的。最后,我只想保留当前类中定义的方法。classFoo{functiona(){}functionb(){}}classBarextendsFoo{functiona(){}functionc(){}}我想保留a和c。 最佳答案 您应该可以调用Reflect

php - 获取错误 "Below is a rendering of the page up to the first error."

我正在使用XMLWriter创建xml。下面是我的代码,它运行良好。openMemory();$writer->startDocument('1.0');$writer->setIndent(4);$writer->startElement('epp');$writer->startElement("command");$writer->startElement("login");$writer->writeElement('clID','hello');//username$writer->writeElement('pw','abcdefg');//password$writer-

javascript - 匿名函数错误 : $ is not defined

当我的PHP页面使用来自javascript文件(my_scripts.js)的内容时,Google开发人员工具显示以下错误:“未捕获的ReferenceError:$未定义scripts.js:1(匿名函数)”my_scripts.js的内容$('a.button').click(function(){window.location.href="another_page.php";});页面和脚本按要求工作。单击元素链接到请求的页面,但出现错误。1)错误原因是什么?2)可以忽略还是应该忽略? 最佳答案 1)看来您的问题是尚未加载j

php - 文件获取内容(): No such host is known error

我正在使用file_get_contents函数将URL转换为字符串:$contents=file_get_contents("http://google.com");但是,我收到以下错误:file_get_contents()[function.file-get-contents]:php_network_getaddresses:getaddrinfofailed:Nosuchhostisknown.如何在我的本地主机上解决这个问题? 最佳答案 您的“本地主机”无法将名称google.com解析为IP地址,这意味着您的机器无法/

PHP is_file() 无法正常工作

我想检查目录中的文件,我正在使用scandir()和is_file()进行检查。在这个简单的代码中,is_file()为我返回了false。但在目录中我有3个文件。$files=scandir('uploads/slideShow');$sfiles=array();foreach($filesas$file){if(is_file($file)){$sfiles[]=$file;//echo$file;}}使用$file变量的scandir()的结果:Array([0]=>.[1]=>..[2]=>6696_930.jpg[3]=>9_8912141076_L600.jpg[4]=>

PHP 日期格式() : How to format date from string value

我有一点PHP代码:$exd=date_create('01Dec,2015');$exd=date_format($exd,'Y-m-d');echo$exd;用于格式化日期。预期输出为2015-12-01但它返回2016-12-01。我错过了什么? 最佳答案 首先使用createFromFormat方法,提供输入格式:$exd=DateTime::createFromFormat('dM,Y','01Dec,2015');//arguments(,)$exd=date_format($exd,'Y-m-d');//thencho

php - 一般错误 : '"mysqldump"' is not recognized as an internal or external command

我用的是LaravelSpatieBackup,安装完成,首先运行这个$composerrequirespatie/laravel-backup$composerrequirespatie/laravel-backupUsingversion^5.6forspatie/laravel-backup./composer.jsonhasbeenupdatedLoadingcomposerrepositorieswithpackageinformationUpdatingdependencies(includingrequire-dev)Packageoperations:3installs