0
我的文件名是abc.php
和如何从PHP的注释行内容
<?php
/*
Template Name: mypage
*/
?>
所以, 如何让abc.php
NAD和使用Template Name
我的网页。 请帮我
我的文件名是abc.php
和如何从PHP的注释行内容
<?php
/*
Template Name: mypage
*/
?>
所以, 如何让abc.php
NAD和使用Template Name
我的网页。 请帮我
你可以使用一些自定义的解析器(有几个可用)或反射,看看这个:
http://php.net/manual/en/reflectionclass.getdoccomment.php
或由svens在这里评论PHP read file comments NOT file content - forgotten
<?php
$source = file_get_contents("file.php");
$tokens = token_get_all($source);
$comment = array(
T_COMMENT, // All comments since PHP5
T_ML_COMMENT, // Multiline comments PHP4 only
T_DOC_COMMENT // PHPDoc comments
);
foreach($tokens as $token) {
if(!in_array($token[0], $comment))
break;
// Do something with the comment
$txt = $token[1];
}
?>
清除问题! Laravel或Wordpress? –
任何一个laravel或wordpress –
你想要模板名称,而应用程序运行,对不对? –