草庐IT

a_function_that_may_fail

全部标签

php - function_exists() 缓存它的查询吗?

我想知道function_exists()在内部缓存其查询? 最佳答案 No,itdoesnot.它只是检查函数是否在函数表中定义。很简单。然而,theZendOpcacheextensionmayoptimizeoutsomecallstofunction_exists()以及在某些情况下可以在编译时评估的某些其他功能。(它只优化了对function_exists()的调用,其中函数由PHP或扩展在内部定义。) 关于php-function_exists()缓存它的查询吗?,我们在St

php - 验证码 file_get_contents() : SSL operation failed

我正在为我的网页使用GooglereCaptcha。在测试模式下一切正常。无SSL。当我在生产环境中测试我的网页时,出现以下错误:Warning:file_get_contents():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:14090086:SSLroutines:SSL3_GET_SERVER_CERTIFICATE:certificateverifyfailedin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.phponline68Warni

PHP 警告 : require_once(/var/www/html/wp-config. php) : failed to open stream: Permission denied in/var/www/html/wp-load. php on line 37

我正在apache上创建一个Wordpress应用程序服务器,在访问url时收到错误500。因此,我确实检查了httpd/logs/error_log,以下是错误[SunJan1522:42:54.4403492017][:error][pid767][client10.203.116.148:9173]PHPWarning:require_once(/var/www/html/wp-config.php):failedtoopenstream:Permissiondeniedin/var/www/html/wp-load.phponline37[SunJan1522:42:54.44

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn

php - 消息 : Call to a member function get_users() on a non-object

嗨,我正在使用codeigniter,对此我还很陌生。我正在做一个简单的程序来显示数据库中的数据。但我有错误!这是我的代码Controller文件用户.phpclassUserextendsCI_Controller{publicfunctionshow(){$result=$this->user_model->get_users();foreach($resultas$object){echo$object->id;}}}?>模型文件用户模型.phpclassUser_modelextendsCI_Model{publicfunctionget_users(){$fetch=$thi

php - "Type error: Too few arguments to function App\Http\Controllers\UserController::attendance(), 0 passed and exactly 1 expected"

我的数据库中有两个表,分别是用户表和出勤表。我现在想做的是根据用户在与他们的个人资料相关联的出勤View中显示数据库中的出勤数据。这是我在userController中的考勤功能。publicfunctionattendance($id){$user=UserProfile::findOrFail($id);$this->authorize('modifyUser',$user);returnview('user.attendance',['user'=>$user]);}这是我到出勤View的路径。Route::get('/attendance/',['as'=>'user.atte

PHP: "Footer function"?

我有一个项目。它有大量的PHP文件。这些文件中的每一个都包含一个标准标题。它们不包含标准页脚。现在我想在每一页结束之前做点什么。我可以遍历每个页面并添加页脚代码,但我想知道是否有更简单的方法(我想我以前见过类似的方法,尽管我可能弄错了)。有没有办法从包含的headerPHP脚本中设置将在页面末尾执行的“Hook”或“触发”函数?我在想类似set_error_handler的东西但要处理页面关闭事件。或者像C的atexit功能。 最佳答案 啊,我终于找到了我要找的功能。相信我,我已经为此寻找了一段时间,而且恰好发现了它!registe

php - PHP : Do I need to explicitly tell it that it's a 301? 中的 301 重定向

这个应该很简单...我是否需要明确告诉PHP我想进行301重定向?像这样...通常,我会省略第一个语句,然后做...第二个示例实际上是302重定向吗? 最佳答案 是的。引用thefinemanual:Thesecondspecialcaseisthe"Location:"header.Notonlydoesitsendthisheaderbacktothebrowser,butitalsoreturnsaREDIRECT(302)statuscodetothebrowserunlessthe201ora3xxstatuscodeha

php - Paypal 响应获取 "Fail"

我正在将Paypal整合到我的购物车中这是我的值(value)转移表ByPaypalClickHere$pid,'pname'=>$pname,'qty'=>$qty,'price'=>$price,'amount'=>$amount);}?>"method="post">">"value="">'value=''/>"value="">这工作正常。但是当我从paypal重定向付款后,我收到失败响应。但在我的发送箱帐户中,它显示我已完成。并显示购物车。我从paypal获取响应的代码是:-";if(strcmp($lines[0],"SUCCESS")==0){echo$lines[0]

php - 助手类 : Static or non-static functions

按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭9年前。当创建一个包含从字符串中去除空格等方法的辅助类时,您是将这些方法创建为static函数还是非static函数?另外,如果静态方法要调用类中的另一个函数do_magic(),该函数应该如何定义为(静态还是非静态?)我们是否必须使用self::?classHelper{publicstaticstrip_whitespace(){//dosomemagicse