草庐IT

wordpress-search-replace-domain

全部标签

PHP 5.3.5 ldap_search() : Search: Can't contact LDAP server

我有一个LDAPPHP类,它适用于我们公司的所有其他PHP安装。但是,现在我从SuSE更改为Ubuntu11.04,代码停止工作。PHP版本为5.3.5。我尝试连接到我们的LDAP服务器。连接到它后,我尝试运行ldap_search。它失败并显示错误消息“ldap_search():搜索:无法联系LDAP服务器”。我使用wireshark查看了流量,可以看到php和ldap之间正在发生通信,可惜没有发生连接。感谢您的意见,乌韦这是我使用的代码:classldap{private$ldap_conn;private$ldaphost;private$ldapport;publicfunc

php - PHP ereg_replace 中的欧元符号

我想在此正则表达式中允许使用欧元符号€,但它不会通过$val=ereg_replace($regex,"[^a-zA-Z0-9[:space:][:blank:]€+-]+",$_REQUEST[$var]); 最佳答案 你有安装mbstring吗?如果是这样,请尝试使用函数mb_ereg_replace().它将支持这个字符(甚至在UTF-8中)。编辑:还要检查mbregex是否打开。有些主机打开mbstring但禁用mbregex(我不知道为什么)。 关于php-PHPereg_re

php - 无法访问 WordPress 中声明的全局变量

我有以下代码:$g_value='something';print"$g_value";functionget_value(){global$g_value;print$g_value;}printget_value();当我在独立的PHP脚本中运行它时,我得到了“somethingsomething”。但是,当我在WordPress插件中运行它时,我只得到“一些东西”——全局声明不会使函数中的var可访问。我认为这应该始终有效,并且不依赖于register_globals或任何其他环境设置。这是怎么回事? 最佳答案 global$

php - preg_replace 能否一次进行多个搜索和替换操作?

这是如何完成的,分几行://$strrepresentsstringthatneedscleaning:$str="Stringwithline\nbreakandtoomuchspaces";//Cleanstringwithpreg_replace():$str=preg_replace('/[\x00-\x09\x0B-\x1F\x7F]|^+|+$/','',$str);$str=preg_replace('/\x0A|+/','',$str);echo$str;//Output:"Stringwithlinebreakandtoomuchspaces"我的问题集中在将两个pr

php - preg_replace 模式和主题数组返回空数组

我想要一种从$keywords中删除$badwords元素的简单方法。我有什么(举个例子)$keywords=array('sebastian','nous','helene','lol');//itcouldbeanythinginfact$badwords=array('nous','lol','ene','seba');//arrayfullofstopwordsthatIwon'twritehere$filtered_keywords=array_filter(preg_replace($badwords,'',$keywords),'strlen');print_r($fil

php - $_FILES 在使用 wordpress 自定义字段图像上传时为空,但它在核心 php 网站中工作

$file_title=$_FILES["pic"]["name"];echo"$file_title";在wordpressfunctions.php文件中;自定义字段方法是:functioncredits_meta(){global$post;$custom=get_post_custom($post->ID);$designers=$custom["designers"][0];$developers=$custom["developers"][0];$producers=$custom["producers"][0];?>DesignedBy:BuiltBy:UploadIma

php - Wordpress:使用数组手动将类添加到 post_class?

我目前正在使用以下代码行:>我基本上希望手动将“缩略图”类添加到此列表项中。我尝试了以下方法,但它阻止了它检索任何类。>谁能帮我解决如何正确格式化这个问题?我对php和wordpress有点陌生。 最佳答案 您可以简单地添加一个新成员到$classes像这样:> 关于php-Wordpress:使用数组手动将类添加到post_class?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questio

php - preg_replace 在省略时插入默认值

我正在尝试为preg_replace处理一些正则表达式,当它不在主题中时,它会插入一个默认的key="value"。这是我所拥有的:$pattern='/\[section([^\]]+)(?!type)\]/i';$replacement='[section$1type="wrapper"]';我想让它变成:[sectiontitle="Thisisthetitle"]进入:[sectiontitle="Thisisthetitle"type="wrapper"]但是当有值的时候,我不希望它匹配。这意味着:[sectiontitle="Thisisthetitle"type="ful

php - 自定义 Wordpress 3.5.2 插件 "You do not have sufficient permissions to access this page."

我一直在尝试按照http://net.tutsplus.com/tutorials/wordpress/creating-a-custom-wordpress将名为custom_rss的自定义Wordpress插件集成到Wordpress中-plugin-from-scratch/.我已经在settings的菜单项中成功获得了正确的URL。但是,当我单击设置下的custom_rss链接时,加载插件的url仅返回带有文本的内容Youdonothavesufficientpermissionstoaccessthispage.。我以super用户管理员身份登录。单击菜单项时触发的脚本是wo

php - Wordpress - 以编程方式添加不生成缩略图的产品

我正在为客户创建自定义CSV导入器并添加了图片,但未正确生成缩略图。使用像RegenerateThumbnails这样的插件后,它们确实可以正确显示。这是我添加附件并将其链接到帖子的代码。$uploadDir='wp-content/uploads/importedproductimages/';$siteurl=get_option('siteurl');$thumbnail='importedproductimages/'.$name;$filename='importedproductimages/'.$name;$wp_filetype=wp_check_filetype($f