草庐IT

TOUR_RESULT

全部标签

php - 是否安全 :cipher encrypted result depend on the server?

我在一个cakephp应用程序中工作,我在其中使用Security::cipher来加密一些数据。它工作得很好,但我已经将文件和数据库移动到另一台服务器,现在加密结果不同了。我试过一些简单的线条:$security=newSecurity;$code=$security->cipher('1234',Configure::read('Security.cipherSeed'));当我打印$code时,两个服务器中的值不同。我在两个core.php文件中配置了相同的Security.cipherSeed。Security::cipher函数是否使用某些服务器值进行加密?谢谢。

php - 扩展 mysqli_result

我已经扩展了PHP的mysqli类,它工作正常。但是如何让它在查询时返回自定义结果对象(或用于插入/更新/删除等的bool值)?namespaceMyApp;classMySQLiextends\mysqli{publicfunctionquery($query,$resultmode=null){//ThisneedstoreturnaMySQLiResultoraboolean}}classMySQLiResultextends\mysqli_result{}这样做我可以返回一个MySQLiResult对象,但我不知道如何为非基于选择的查询返回一个bool值:publicfunct

php - 如何倒回 pg_fetch_assoc($result, null) 迭代器

我正在使用pg_fetch_assoc迭代SQL查询的结果,但我需要多次执行此操作,而且我找不到“倒回”迭代器的方法。while($record=pg_fetch_assoc($result,null)){if($record["position"]==$position_cell){echo"J".$record["order"]."";};}所以,如果这个$result包含4行,我将遍历其中的四个,但是当我再次执行这段代码时,它什么也不会做。我知道我可以用一个整数而不是空值进行迭代,但是我必须计算行数,我发现这种语法非常方便,所以如果你能告诉我一个方法就太好了去做。非常感谢。

php - 在 PHP : An exception has been raised as a result of client data 中调试 SOAP 调用

我正在使用UPSAPI,但在调试时遇到困难。我得到以下堆栈跟踪:DetailsType:SoapFaultMessage:Anexceptionhasbeenraisedasaresultofclientdata.File:/Users/shawn/Documents/work/sites/Wingspan/kaleco/lib/SixString/Utilities/Ups.phpLine:161Trace#0/Users/shawn/Documents/work/sites/Wingspan/kaleco/lib/SixString/Utilities/Ups.php(161):S

php - var_dump($_FILES) result in blank ["type"] 对于特定的图像文件

我有一张用旧数码相机拍摄的图像,大小约为4MB,类型为“image/jpeg”。当我通过表单提交并查看var_dump($_FILES);时,数组如下:array(1){["userfile"]=>array(5){["name"]=>string(12)"IMGP0004.JPG"["type"]=>string(0)""["tmp_name"]=>string(0)""["error"]=>int(1)["size"]=>int(0)}}我想知道它是否没有选择文件类型并将文件大小检测为0是否有原因。其他文件回显所有正确信息。 最佳答案

PHP : imploding array and storing the result back to same variable

下面的代码有没有坑。这样使用安全吗?我不会再使用该阵列$records_msg=implode("",$records_msg); 最佳答案 不是真的,但是为数组使用不同的变量名可能会提高可读性,因为它还不是消息。 关于PHP:implodingarrayandstoringtheresultbacktosamevariable,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/33

PHP "list"问题 : Why the result is in reverse order?

您能否详细解释为什么出现此代码:$arr=array(1,2,3);list($result[],$result[],$result[])=$arr;print_r($result);结果:Array([0]=>3[1]=>2[2]=>1)? 最佳答案 请参阅list的PHP文档:list()assignsthevaluesstartingwiththeright-mostparameter.Ifyouareusingplainvariables,youdon'thavetoworryaboutthis.Butifyouareusi

php - 扩展 mysqli_result - 它使用 store_result() 还是 use_result()

我用返回mysqli_result的子项的查询方法编写了一个mysqli的子项。此结果子项将具有我的应用独有的其他方法。publicMySQLextendsmysqli{publicfunctionquery($query){if($this->real_query($query)){if($this->field_count>0){returnnewMySQL_Result($this);}returntrue;}returnfalse;}}classMySQL_Resultextendsmysqli_result{publicfunctionfetch_objects(){$row

php/mysqli : should I free_result before I return?

Ifcalledfromwithinafunction,thereturnstatementimmediatelyendsexecutionofthecurrentfunction,andreturnsitsargumentasthevalueofthefunctioncall.引自php手册:http://php.net/manual/en/function.return.php所以如果我要编写这个函数:publicfunctioncheck_db_for_desired_value(){//...connecttodb,preparestmt,etc.while(mysqli_st

php - 如何在 mysqli 中转换 mysql_result?

这个问题在这里已经有了答案:Singleresultfromdatabaseusingmysqli(6个答案)关闭8个月前。这段代码以前在mysql中,现在因为它已被弃用,我决定在mysqli中转换我的代码,但是我在我的页面中遇到了这个问题,在它与mysql一起工作之前没有错误,但是我的页面有分页现在我在这一行中得到一个错误:Warning:mysqli_fetch_assoc()expectsexactly1parameter,2given这个错误很明显,我知道,但我不知道如何用另一种方式来做,因为之前我在那行的代码是$pages=ceil(mysql_result($pages_q