PHP头条
热点:

自己常用的一个PHP模板引擎-PHP源码


[PHP]代码

function mb($str, $left, $right) {
	 	//if操作
	 	$str = preg_replace( "/".$left."if([^{]+?)".$right."/", "", $str );
		$str = preg_replace( "/".$left."else".$right."/", "", $str );
		$str = preg_replace( "/".$left."elseif([^{]+?)".$right."/", "", $str );
		//foreach操作
		$str = preg_replace("/".$left."foreach([^{]+?)".$right."/","",$str);
		$str = preg_replace("/".$left."\/foreach".$right."/","",$str);
		//for操作
		$str = preg_replace("/".$left."for([^{]+?)".$right."/","",$str);
		$str = preg_replace("/".$left."\/for".$right."/","",$str);
		//输出变量
		$str = preg_replace( "/".$left."(\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_$\x7f-\xff\[\]\'\']*)".$right."/", "", $str );
		//常量输出
		$str = preg_replace( "/".$left."([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)".$right."/s", "", $str );
		//标签解析
		$str = preg_replace ( "/".$left."\/if".$right."/", "", $str );
	 	$pattern = array('/'.$left.'/', '/'.$right.'/');
		$replacement = array('');
		return preg_replace($pattern, $replacement, $str);
	 }

www.phpzy.comtrue/php/35894.htmlTechArticle自己常用的一个PHP模板引擎-PHP源码 [PHP]代码 function mb($str, $left, $right) { //if操作 $str = preg_replace( "/".$left."if([^{]+?)".$right."/", " ", $str );$str = preg_replace( "/".$left."else".$right."/", " ", $str );$str...

相关文章

PHP之友评论

今天推荐