草庐IT

a_function_that_may_fail

全部标签

php - WordPress 错误 : Call to undefined function in plugin

我一直在使用ShortcodeExecPHP插件编写一个函数,当我在编辑器中运行该函数时效果很好。当我将它移动到插件时,我开始在日志中看到如下错误:PHPFatalerror:Calltoundefinedfunctionwp_create_category()我意识到这是因为缺少包含等。为插件包含内置wordpress功能的正确方法是什么?我的插件使用了以下wordpress函数wp_create_categoryusername_existswp_generate_passwordwp_create_userwp_insert_postupdate_post_metaadd_pos

php - wrap-function, wrap-raf, contextual-ee 附加在网页上

我的网站出现异常行为。我最近在网站管理员工具上发现,它发现我网站上的许多网页都出现抓取错误404。我无法理解这些页面是如何创建的,因为所有404页面最后都包含这几个字wrap-function,contextual-ee,wrap-events,wrap-raf,wrap-timer,wrap-xhr这些页面是通过在正常工作页面的末尾附加这些词之一来创建的。例如404页面是:mywebsite.com/normalpage1/wrap-funcionmywebsite.com/nromalpage2/wrap-eventmywebsite.com/normalpage3/wrap-ti

php - 通知 : Undefined index: HTTP_X_FORWARDED_FOR Error in Function

我收到通知:未定义索引:以下函数中的HTTP_X_FORWARDED_FOR:function_ip(){return(preg_match("/^([d]{1,3}).([d]{1,3}).([d]{1,3}).([d]{1,3})$/",$_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']);} 最佳答案 您应该使用getenv()方法而不是$_SERVER。function_ip(){if(preg_

PHP "Warning: usort() [function.usort]: Invalid comparison function"排序

我有以下数据作为关联数组array'abc'=>array'label'=>string'abc'(length=3)'weight'=>float3'wsx'=>array'label'=>string'wsx'(length=3)'weight'=>float1'qay'=>array'label'=>string'qay'(length=3)'weight'=>float1'http://test.com'=>array'label'=>string'http://test.com'(length=15)'weight'=>float0'Nasi1'=>array'label'=

PHP fatal error : 'Swift_TransportException' with message 'Failed to authenticate on SMTP server

我知道之前有人问过这个问题,我已经阅读了那里的所有帖子,但我仍然找不到解决方案。我有一台安装了wamp的Windows机器。当我尝试通过谷歌的SMTP服务器发送一封简单的电子邮件时,一切正常。但是,当我将相同的脚本复制到Ubuntu12机器时,它给了我这个错误:PHPFatalerror:Uncaughtexception'Swift_TransportException'withmessage'FailedtoauthenticateonSMTPserverwithusername"xxx@gmail.com"using2possibleauthenticators'in/home/

php - 文件()[函数.文件] : php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

从文件("http://www.otherdomain.com")获取内容时出现以下错误。file()[function.file]:php_network_getaddresses:getaddrinfofailed:Temporaryfailureinnameresolution域服务器是linux。如何解决这个问题? 最佳答案 引用:Ifyou'rehavingproblemswithfopen("url...")butyoucanrun'hosturl'inashellwindowandgetthecorrectlookup

php - fatal error : Call to undefined function easter_date()

我正在尝试获取今年的easter_date。这是我的代码:当我执行代码时出现以下错误:fatalerror:在中调用未定义的函数easter_date()我的php版本是5.3.3。我正在使用Linux(Ubuntu)。您知道缺少什么吗? 最佳答案 如果您使用基于php:7.1的Dockerfile,您可以轻松安装calendar扩展:RUNdocker-php-ext-installcalendar&&docker-php-ext-configurecalendar 关于php-fat

php - Jquery-fileupload 插件 - 上传文件但显示 'file upload failed'

我点击“添加文件”选择一个文件,然后它会创建一个缩略图(取决于浏览器)并在其下方显示“上传”按钮。当我点击“上传”时,有时它会上传文件并提示“文件上传失败”。-文件实际上已上传,但我仍然收到此消息。有时它不会上传,我会收到相同的消息。我有两个错误-第一个在PHP错误日志中'PHPWarning:exif_imagetype():Filenamecannotbeemptyin***\***\UploadHandler.php'我不明白不过,它一直都是。第二个是页面上的jquery.validation-'UncaughtError:Syntaxerror,unrecognizedexpr

php - 警告 : ssh2_connect(): Failed overriding server to client COMP method

我在为PHP中的SSHsession启用压缩时遇到问题。部分代码:$methods=array('server_to_client'=>array('comp'=>'zlib'));if(!($con=ssh2_connect("10.214.201.31",22,$methods))){...执行期间的警告(通过httpd或phpcli):Warning:ssh2_connect():FailedoverridingservertoclientCOMPmethod压缩不起作用(通过ssh2_scp_recv下载测试文件的时间没有改变)。设置客户端到服务器压缩后出现类似警告。PHPVe

PHP 问题 : password_hash function is not able to generate a salt

我正在创建一个用户注册服务提供商,我正在使用password_hash函数来散列提供的用户密码。以下是用于创建散列字符串的代码部分:publicfunctiongenerateHash($string){returnpassword_hash($string,PASSWORD_BCRYPT);}正如我从PHP手册中了解到的那样,我们不应该生成我们的盐,而是让password_hash函数来处理它以提高安全性。但是,当我尝试创建新用户时,我收到以下警告:Warning:password_hash():Unabletogeneratesalt应用程序创建了用户,但由于上述问题,不会生成哈希