草庐IT

Sampling_from_a_multinomial_distr

全部标签

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 Twig : access current template variable from within macro without passing?

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

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 - Vagrant/Puppet --- 确保 : change from present failed: Could not set 'present on ensure: No such file or dir

我正在使用Vagrant和Puppet在Ubuntu上安装Apache和PHP。但是,我在vagrantup期间收到以下错误。我认为模板的路径是正确的,那为什么会出错呢?我正在使用设置here修改以确保apt-getupdate在任何其他操作之前运行错误←[1;35merr:/Stage[main]/Php/File[/etc/php5/apache2/apc.ini]/ensure:从缺席出席失败:无法设置“出席确保:没有这样的文件或目录ectory-/etc/php5/apache2/apc.ini.puppettmp_6187在/tmp/vagrant-puppet/module

php - 为什么我从 SagePay 收到错误 "4020 : Information received from an Invalid IP address."?

这是一个PHP(ZendFramework1.11)站点,未使用现成的软件包。当请求到:https://live.sagepay.com/gateway/service/vspserver-register.vsp(使用PAYMENT的TxType),我得到以下响应:4020:InformationreceivedfromanInvalidIPaddress.我已登录到SagePay管理区域并将实时服务器的IP地址添加到有效IP部分,我已确保它使用正确的SagePayURL发布到和。需要注意的是,这个问题是今天早上开始的,当时我们通过更改Vendor属性更改了接收付款的SagePay帐

php - 恐惧超时与 'mod_fcgid: read timeout from pipe'

我的应用程序尝试访问超时的URL有问题。我正在trycatch此超时并使用以下代码解决此问题:$timeout=120;if(false==$handle=@fsockopen($host,$port,$errno,$errstr,$timeout)){thrownewException("Couldnotconnecttourl:".$errstr);}$getRequest="GET{$url}HTTP/1.0\r\n";$getRequest.="Host:{$urlParts['host']}\r\n";$getRequest.="Connection:close\r\n\r\

PHP : Show the headers received from the browser

因此,当浏览器向服务器发出HTTP请求时,它采用一些header(get/post、cookies、host、UserAgent等)的形式。有没有一种方法可以在php脚本中读取和显示它们?是的,$_GET、$_POST和$_COOKIE都在那里。我正在寻找其余的标题信息。例如http://pgl.yoyo.org/http/browser-headers.php谢谢。 最佳答案 get_headers()功能是你要找的。如引用get_headers—Fetchesalltheheaderssentbytheserverinrespo

PHP/Zend : How to remove all chars from a string and keep only numbers

我只想保留数字并从变量中删除所有字符。例如:input:+012-(34).56.(ASD)+:"{}|78*9output:0123456789 最佳答案 这是一般的做法:$numbers=preg_replace('/[^0-9]+/','','+012-(34).56.(ASD)+:"{}|78*9');echo$numbers;输出:0123456789 关于PHP/Zend:Howtoremoveallcharsfromastringandkeeponlynumbers,我们在

php - Symfony2 表单集合 : How to remove entity from a collection?

我尝试从集合中删除实体,但它不起作用。我想我在某处有错误,但我不知道在哪里。这是我的updateAction中的代码:$em=$this->getDoctrine()->getEntityManager();$entity=newPerson();if(!$entity){throw$this->createNotFoundException('UnabletofindPersonentity.');}$editForm=$this->createForm(newPersonType(),$entity);$deleteForm=$this->createDeleteForm($id)

php - 谷歌 PHP API : "invalid response from api server"

我在本地主机上的GoogleAppEngine上运行的应用程序中使用GooglePHPAPIClientv2.0。当我将我的应用程序发布到GoogleAppEngine产品时,我没有收到错误,但它是间歇性的,所以很难知道我是否只是在生产中走运。我的GoogleAPI客户端正在尝试将文件写入我的Google云端硬盘。这段代码几个月来一直运行良好,但今天早上突然停止运行。我检查了GoogleAPI状态,他们没有报告任何中断。当我执行任何API调用时,我得到这个模糊的错误响应:Fatalerror:fopen():InvalidresponsefromAPIserver.in/Users/m