草庐IT

function_exists

全部标签

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 - Symfony 2.5 "You have requested a non-existent service "siteTest.b"

当运行workspace/app_dev.php时,没问题。但是当我尝试运行workspace/app.php时,我得到:"Youhaverequestedanon-existentservice"siteTest.b"我不知道我做错了什么。应用程序/配置/config.yml:imports:-{resource:parameters.yml}-{resource:security.yml}framework:secret:"%secret%"router:resource:"%kernel.root_dir%/config/routing.yml"strict_requiremen

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 - 在 Windows 上的 file_exists() 中使用 DIRECTORY_SEPARATOR

var_dump(DIRECTORY_SEPARATOR)//string'\'(length=1)var_dump(file_exists("C:/1212.txt"));//truevar_dump(file_exists("C:\1212.txt"));//falsevar_dump(file_exists("C:".DIRECTORY_SEPARATOR."1212.txt"));//falseDIRECTORY_SEPARATOR有什么作用?为什么在使用DIRECTORY_SEPARATOR时上述情况为假? 最佳答案 Wh

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 - : print var if var exist 的 PHP 简写是什么

我们以前都遇到过,需要在输入字段中打印一个变量,但不确定是否设置了var,就像这样。基本上这是为了避免e_warning。'>我怎样才能把这个写得更短?我可以引入这样的新功能:'>但是我没有成功编写printvar()函数。 最佳答案 对于PHP>=7.0:从PHP7开始,您可以使用null-coalesceoperator:$user=$_GET['user']??'guest';或者在你的用法中:对于PHP>=5.x:我的建议是创建一个issetor函数:functionissetor(&$var,$default=null){

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应用程序创建了用户,但由于上述问题,不会生成哈希

php - preg_match() [function.preg-match] : Unknown modifier

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭10年前。我收到此错误消息:preg_match()[function.preg-match]:Unknownmodifier'='in/home/public_html/checkem.phponline13当我转到以下行时,我得到了这个:我已将ereg更改为preg_match然后用//包装代码,因为ereg出现了作为弃用。我仍然是编码的初学者,非常感谢任何帮助。