草庐IT

parameter-passing

全部标签

php - Symfony 2 Embedded Forms: Catchable Fatal Error: Argument 1 passed to Entity::addProperty must be an instance of XX\MyClass, 数组给定

我已经读过this和this和其他人,但没有人解决我的问题。我已经删除了所有可能的内容并将范围缩小到一个字段:地址。当我尝试关注thistutorial时,如果我遵循它,一切都会正常,从一个全新的新项目开始。但是当我在我的其他项目中手动执行时,我得到了这个错误:“可捕获的fatalerror:传递给BN\Bundle\MyBundle\Entity\PersonTeacher::addAdresse()的参数1必须是BN\Bundle\MyBundle\Entity\Adresse的实例,C:\Users\Olivier\PhpstormProjects\中给出的数组My\My\src

php - 使用 cURL 发布数据时出现 "Positional Parameter"错误

如果我在没有--data"..."的情况下发出命令,它会工作得很好。我试过谷歌,但找不到这个问题的任何答案。按照位于here的指示进行操作当我尝试使用cURL发布数据时出现以下错误:PSC:\Users\David>curl--data"SMethod=0""http://localhost/terra/modules/scripts/Query.php"Invoke-WebRequest:Apositionalparametercannotbefoundthatacceptsargument'SMethod=0'.Atline:1char:1+curl--data"SMethod=0

php - 如何避免 "Entities passed to the choice field must be managed. Maybe persist them in the entity manager?"

GeneratedEntities来自现有数据库GeneratedCRUDController但它不适用于异常消息:Entitiespassedtothechoicefieldmustbemanaged.Maybepersistthemintheentitymanager?实体/***Question**@ORM\Table(name="question",indexes={@ORM\Index(name="question_category_id",columns={"question_category_id"})})*@ORM\Entity*/classQuestion{//...

php - 拉维尔 5 : Fetch ajax data in route and pass to controller

我正在使用Laravel5并希望使用一些数据对Controller进行ajax调用:$.ajax({url:"/getOrgById",data:JSON.stringify({id:1})})routes.php有:Route::get('/getOrgById','HomeController@getOrgById');HomeController.php:publicfunctiongetOrgById($data){//codeherefailswithmessage'Missingargument1forHomeController::getOrgById()}如何将数据从a

php - openssl_pkey_export 和 "cannot get key from parameter 1"

我需要在我的php项目中使用openssl,所以我使用openssl创建了一个测试php页面。但是,我不断收到这些错误,我不确定为什么。openssl已启用。Warning:openssl_pkey_export()[function.openssl-pkey-export]:cannotgetkeyfromparameter1inC:\wamp\www\opensslsample\index.phponline18Warning:openssl_pkey_get_details()expectsparameter1toberesource,booleangiveninC:\wamp\

php - Varnish `(pipe)` 和 `(pass)` 之间的区别

我正在使用varnishconfigurationIdidn'twrite,并且此配置似乎可以互换使用(pass)和(pipe)。我不太清楚这两个操作之间到底有什么区别。关于(pipe)的手册部分对我来说有点神秘Pipecanbereturnedfromvcl_recvaswell.PipeshortcircuitstheclientandthebackendconnectionsandVarnishwilljustsitthereandshufflebytesbackandforth.Varnishwillnotlookatthedatabeingsendbackandforth-s

php - 结束( explode )严格标准 : Only variables should be passed by reference in

我有这段代码来获取文件的扩展名:$extension=end(explode(".",$_FILES["rfile"]["name"]));这在本地主机上工作正常,但是当我上传在线托管时,它给了我这个错误:StrictStandards:Onlyvariablesshouldbepassedbyreferencein... 最佳答案 为什么不使用pathinfo(PHP>=4.0.3),即:$ext=pathinfo($_FILES["rfile"]["name"])['extension'];现场PHP演示http://ideon

php - 在 PHP 中使用引用

我问这个问题是因为我了解到在编程和设计中,您必须有充分的决策理由。我是php学习者,我正处于十字路口,我正在使用简单的增量来尝试解决我的问题。我当然不是在这里开始争论引用的优缺点,但是当涉及到php时,这是更好的编程实践:functionincrement(&$param){++$param;}对比functionincrement($param){return++$param;}$param=increment($param); 最佳答案 首先,referencesarenotpointers.我尝试了@John在他的回答中给出的

php - 给出警告 : number_format() expects parameter 1 to be double, 字符串

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭7年前。Improvethisquestion我的页面slider出现此错误:Warning:number_format()expectsparameter1tobedouble,stringgivenin/home/globalar/public_html/wp-content/themes/au

PHP:通过引用传递给函数的数组?

我有这个php函数,它必须对给定的数组执行一些处理:processArray($arrayToProcess){$arrayToProcess['helloStackOverflow']=TRUE;}稍后,代码调用以下内容:$niceArray=array('key'=>'value');processArray($niceArray);键“helloStackOverflow”在processArray函数之外不可用。我尝试调用以下内容:processArray(&$niceArray);使用“&”有帮助,但它会引发一些警告:Deprecatedfunction:Call-timep