草庐IT

slug-compiler

全部标签

php - Wordpress - 通过 slug 获取标签 ID

我正在尝试通过slug获取标签的id\name。那是我的代码:$tag=get_term_by('slug','hedoms','post_tag');$tag_id=$tag->term_id;name;?>我是从这里拿来的:https://codex.wordpress.org/Function_Reference/get_term_by我的标签带有slughedoms但为空,则不返回值。我已经用类别尝试了这个函数(get_term_by)-并且结果相同。第二个字段是slug。但如果我使用id而不是slug,它工作正常:$tag_id=get_term_by('id',97,'po

php - 警告 : preg_match(): Compilation failed: unrecognized character after (? 或 (?-

我有一个以前的程序员编写的代码,一个抛出编译错误的正则表达式preg_match:$regex_t="/".$op."(?\\>[^".$op.$cl."]+)*".$cl."/s";preg_match($regex_t,$text,$inner);我收到的警告是:Warning:preg_match():Compilationfailed:unrecognizedcharacterafter(?or(?-atoffset4另外,我想提一下var_dump($regex_t)的值是:string'/\{(?\>[^\{\}]+)*\}/s'(length=21)

php - preg_match 错误 : Compilation failed: missing terminating ] for character class

我在for循环中读取了一系列.txt文件。我在一些文本文件中放置了一个token,格式为[widget_]因此,例如,文本文件的全部内容可能是[widget_search]。另一个文本文件可能包含内容[widget_recent-posts]。其他人可能只有html格式的文本,根本没有token。在for循环中,我正在执行preg_match以查看文本文件的内容是否与我的标记模式匹配。如果匹配,我将执行一些条件代码。但是,当我运行跟踪测试以查看是否存在匹配时出现错误。错误是:警告:preg_match()[function.preg-match]:编译失败:在C:\xampplite\

php - Google Closure Compiler 和 multipart/form-data 不工作

我正在向google闭包编译器API服务发出请求:$content=file_get_contents('file.js');$url='http://closure-compiler.appspot.com/compile';$post=true;$postData=array('output_info'=>'compiled_code','output_format'=>'text','compilation_level'=>'SIMPLE_OPTIMIZATIONS','js_code'=>urlencode($content)));$ch=curl_init();curl_se

php - preg_match "Compilation failed: missing )"

这可能是一个愚蠢的错误,但我有一个正则表达式应该匹配什么阿拉拉afkdsf[]afadf43fds["guyish"]但不是以数字开头的字符串这是代码preg_match('~^[A-Za-z][A-Za-z0-9]*(\[(?P"(?:.*(?:(?\\\\)*\").*|.*)+(?:(?\\\\)*"))\]|\[\]|)$~',trim($item[0],"\r"),$matches)但是当我执行它时,我得到错误Compilationfailed:missing)atoffset95当我执行它时here它工作正常吗?代码有什么问题?更新可读的正则表达式:~^[A-Za-z][A

php - Slug 功能在我的主机上不起作用 - 删除了特殊字符

我在使用slug函数从某个字符串创建slug时遇到了一个奇怪的问题。functioncreateSlug($str,$replace=array(),$delimiter='-'){setlocale(LC_ALL,'en_US.UTF8');if(!empty($replace)){$str=str_replace((array)$replace,'',$str);}$clean=iconv('UTF-8','ASCII//TRANSLIT',$str);$clean=preg_replace("/[^a-zA-Z0-9\/_|+-]/",'',$clean);$clean=strt

php - Symfony 3.3 从 3.2 : Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap

自从我从symfony3.2更新到3.3后我遇到了一些问题,我得到了这个错误CompileError:CannotdeclareclassSymfony\Bundle\SecurityBundle\Security\FirewallMap,becausethenameisalreadyinuseinclasses.php(line1709)inClassCollectionLoader.php(line99)atClassCollectionLoader::load()inKernel.php(line428)atKernel->doLoadClassCache()inKernel.p

未找到 PHP __halt_compiler

我正在使用PHP5.6运行本地服务器。我正在使用第三方库,该库使用函数__halt_compiler。达到此功能后,我收到以下错误。PHPFatalerror:Uncaughtexception'UnexpectedValueException'withmessage'internalcorruptionofphar'.(__HALT_COMPILER();notfound)我使用关键字phar和__halt_compiler进行的所有搜索都没有结果。以下是打印phpinfo()的一些细节。Phar:PHPArchivesupport=>enabledPharEXTversion=>2

php - 没有自定义帖子类型 slug 的 WordPress slug

我已使用以下代码注册自定义帖子类型:register_post_type(array('labels'=>//arrayoflabels,'public'=>true,'publicly_queryable'=>true,'show_ui'=>false,'map_meta_cap'=>true,'show_in_menu'=>false,'query_var'=>true,'rewrite'=>array('slug'=>'movie'),'capability_type'=>'post','has_archive'=>false,'exclude_from_search'=>tru

php - 显示带短划线的 URL slug 时出现问题

我为我的故事URL创建了一个带有破折号的slug,例如:FetchingrecordswithsluginsteadofID这是我创建slug的代码:functionSlugit($title){$title=strip_tags($title);//Preserveescapedoctets.$title=preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|','---$1---',$title);//Removepercentsignsthatarenotpartofanoctet.$title=str_replace('%','',$title);/