草庐IT

外参数

全部标签

PHP ODBC 存储过程无效参数号

我100%是SQL/PHP/ODBC/FBI/TLA等世界的新手,所以如果我问的问题非常基础,我深表歉意。我正在使用一个存储过程,该过程使用邮政编码的纬度/经度数据库将中心邮政编码和给定的英里半径作为2个输入参数,然后返回该给定英里半径内的邮政编码数组。当我在我的SQL查看器中运行它时它工作得很好,但是当我尝试使用php来做同样的事情时,我只得到无效参数错误。$connstr="Driver={SQLServer};Server=MyServer;Database=MyDatabase;";$conn=odbc_connect($connstr,"Name","PW");$query_

php - 在 CakePHP 中将斜杠参数传递给 requestAction

我正在尝试将字符串传递给requestaction。在myController文件中:publicfunctionmyAction($name){$data=unserialize(file_get_contents($name));return$data;}在我的View文件中:$f="/home/myaccount/file.txt";$g=$this->requestAction(array('controller'=>'myController','action'=>'myAction'),$f);如何传递具有特殊字符的参数? 最佳答案

php - 通过参数传递对象的键

我有这个代码:functioncmp_asc($a,$b){$ta=date_create_from_format('Y/m/d',$a['props']['t']);//Y/n/jsinotienen0inicial$tb=date_create_from_format('Y/m/d',$b['props']['t']);$interval=date_diff($ta,$tb);if($interval->days!=0){if($interval->invert==1){return1;}else{return-1;}}else{return0;}}$arr1=array('pro

php - imagesx() 期望参数 1 为资源, bool 值给定

我正在使用图像缩略图库(Laravel的resizerbundle),它从目录中获取jpg并使用imagesx()以不同的大小保存该图像。这在大多数情况下都可以正常工作。问题:然而,有时当有一批图像要处理时,我会收到以下错误。在调试时,我做了....print_r($this->image);imagesx($this->image);....PHP输出Resourceid#64Resourceid#67Resourceid#73Resourceid#76Resourceid#82Resourceid#85Resourceid#91Resourceid#94Resourceid#100

php - 模型参数设置最佳实践?

我有一个模型,它在SQL中使用一系列条件运行查询。因此,模型需要接受很多参数,即:this->model_name->method($param1,$param2,...)在模型方面,我通常将其设置为functionmethod($param1=NULL,$param2=NULL,...)这些参数中的每一个都是可选的,并且应用程序的用例会有所不同。所以我的问题是:在什么时候(如果有的话)开始通过数组将这些参数传递给方法是有意义的,ala:$params=['param1'=>'whatever','param2'=>'whatever',...]this->model_name->me

php - 区分哪些参数属于哪个对象

这是一个非常具体的问题,我无法在任何地方找到答案。这适用于很多语言,但我特别想在PHP中弄清楚。为此,我将使用“事件”作为我们的类(class)。简单来说,有两种类型:abstractclassEvent{protected$cost;protected$startTime;publicfunction__construct(){foreach($eventDataas$key=>$val){if(property_exists($this,$key)){$this->$key=$val;}}}}和classPartyextendsEvent{private$hasPointyHats

php - Doctrine DQL 无效参数编号 : number of bound variables does not match number of tokens

我在这个查询中收到错误无效的参数编号:绑定(bind)变量的数量与标记的数量不匹配。我真的没有看到问题,有什么想法吗?publicfunctiongetByPartial($q,Company$company){$query=$this->createQueryBuilder('u')->join('u.company',':company')->where('u.firstNameLIKE:q')->orWhere('u.lastNameLIKE:q')->setParameters(array('company'=>$company,'q'=>'%'.$q.'%'))->getQu

php - 在 phpunit 中测试构造函数参数

我们使用Varien_Http_Client从Magento扩展发出http请求,如下所示:publicfunctioncallApi(…){//Setdefaultfactoryadaptertosocketincasecurlisn'tinstalled.$client=newVarien_Http_Client($apiUri,array('adapter'=>'Zend_Http_Client_Adapter_Socket','timeout'=>$timeout,));$client->setRawData($xmlDoc->saveXML())->setEncType('t

PHP:当它们是方法参数时如何记录数组

这个问题在这里已经有了答案:PHPDocforvariable-lengtharraysofarguments(7个答案)关闭4年前。当数组元素作为方法的参数时,记录数组元素的最佳方式是什么?例如,使用PHPDocheader,我可能有类似的内容:@paramarray$data这没有告诉我数组中哪些元素是必需元素,哪些元素是可选元素。我想这应该放在方法的解释中。像这样的东西:array:$data============int$idRequiredname$stringRequiredtown$stringOptional

c# - RSA 加密中的 fOAEP 参数

RSACryptoServiceProvider.Encrypt()有两个参数:rgb(要加密的数据)和fOAEP。fOAEP是一个bool值,用于确定应使用哪种填充:fOAEPType:System.BooleantruetoperformdirectRSAencryptionusingOAEPpadding(onlyavailableonacomputerrunningMicrosoftWindowsXPorlater);otherwise,falsetousePKCS#1v1.5padding.它说true只能在WindowsXP或更高版本上工作,但我认为这不一定包括Linux和