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 –
你想要模板名稱,而應用程序運行,對不對? –