详细的PHP代码:
//获取php内容
$fileContent = file_get_contents('test.php');
//$regAction = "/(\/\*\*((?!.*?\/\*).*)\*\/)?(public)?functionaction([a-z\d_]+)?\(/iU";
$regAction = '/(\/\*\*((?!.*?\/\*).*)\*\/)?(public)?function(action[a-z\d]+?)\(/iU'; //解析注释和action控制器
preg_match_all($regAction, $fileContent, $match);
echo "<pre>";
print_r($match);
非贪禁模式正则帮助:
//正则表达式 不包含指定字符串
//http://blog.csdn.net/maqingli20/article/details/7317925
^(?!.*?robots).*$ //不包含指定字段串
((?!.*?\/\*).*) //不包含 /*