首页 php教程 php手册 自己练手写的模板引擎

自己练手写的模板引擎

Jun 06, 2016 pm 07:39 PM
引擎 模板 自己

自己练手写的模板引擎 使用方法: include(SITE_PATH./b/GyT.php); $t=new GyT(); $t-setGyiCharset(utf-8); $t-setFrontSeparator({@#); $t-setBackSeparator(#@}); //设置显示的文件名 $t-setInVtrParameter(a1, guoyong我是1); $t-setInVtrParameter(a2, g

自己练手写的模板引擎
使用方法:
include(SITE_PATH."/b/GyT.php");
$t=new GyT();
$t->setGyiCharset("utf-8");
$t->setFrontSeparator("{@#");
$t->setBackSeparator("#@}");
//设置显示的文件名
$t->setInVtrParameter("a1", "guoyong我是1");
$t->setInVtrParameter("a2", "guoyong我是2");
$t->setInVtrParameter("a3", "guoyong我是3");
$t->setInVtrParameter("a4", "guoyong我是4");
$t->setInVtrParameter("a5", "guoyong我是5");

$t->setInIfParameter("guoyong", 1);
$a=array(
array("Id"=>"1","Title"=>"测试一下1"),
array("Id"=>"2","Title"=>"测试一下2"),
array("Id"=>"3","Title"=>"测试一下3"),
array("Id"=>"4","Title"=>"测试一下4"),
array("Id"=>"5","Title"=>"测试一下5")
);

$b=array(
array("Id"=>"1","Title"=>"测试一下1"),
array("Id"=>"2","Title"=>"测试一下2"),
array("Id"=>"3","Title"=>"测试一下3"),
array("Id"=>"4","Title"=>"测试一下4"),
array("Id"=>"5","Title"=>"测试一下5")
);
$t->setInForParameter("netlist", $a);
$t->setInForParameter("netlist1", $b);
$FileName=SITE_PATH."/s/t/default/index1.html";
$t->setFile($FileName);
$t->parse();
echo $t->Out();

<?php
include(SYSTEM_PATH.'/b/GyIf.php');
include(SYSTEM_PATH.'/b/GyFor.php');

class GyT {
	private $_gyFile = "";
	private $_gyFrontSeparator = "{";
	private $_gyBackSeparator = "}";
	private $_gyiCharset;
	private $_gyInVar=array();
	private $_gyInFor=array();
	private $_gyInIf=array();
	private $_gyContent = "";
	private $_gyParameterArray;
		
	private function getContent()
	{
		if(isset($this->_gyContent))
		{
			return($this->_gyContent);
		}else
		{
			return(NULL);
		}
	}
	
	private function setContent($content)
	{
		$this->_gyContent = $content;
	}
	
	private function getGyiCharset()
	{
		if(isset($this->_gyiCharset))
		{
			return($this->_gyiCharset);
		}
		else
		{
			return(NULL);
		}
	}
	public function setGyiCharset($gyiCharset)
	{
		$this->_gyiCharset = $gyiCharset;
	}
	
	public function setFrontSeparator($gytemp) {
		$this->_gyFrontSeparator = $gytemp;
	}
	
	private function getFrontSeparator() {
		return $this->_gyFrontSeparator;
	}

	public function setBackSeparator($gytemp) {
		$this->_gyBackSeparator = $gytemp;
	}
	
	private function getBackSeparator() {
		return $this->_gyBackSeparator;
	}

	public function setFile($gyfile) {
		$this->_gyFile = $gyfile;
	}

	private function getFile() {
		return $this->_gyFile;
	}
	
	public function setInVtrParameter($ParameterName, $ParameterVale) {
		//判断键是否存在
		if (array_key_exists($ParameterName,$this->_gyInVar))
		{
			//已经存在
			$this->_gyInVar[$ParameterName]=$ParameterVale;
		}
		else
		{
			//不存在
			$tempA=array($ParameterName=>$ParameterVale);
			$tempB=$this->_gyInVar;
			$this->_gyInVar=array_merge($tempA,$tempB);
		}
	}
	
	public function setInIfParameter($ParameterName, $ParameterVale) {
		//判断键是否存在
		if (array_key_exists($ParameterName,$this->_gyInIf))
		{
			//已经存在
			$this->_gyInIf[$ParameterName]=$ParameterVale;
		}
		else
		{
			//不存在
			$tempA=array($ParameterName=>$ParameterVale);
			$tempB=$this->_gyInIf;
			$this->_gyInIf=array_merge($tempA,$tempB);
		}
	}
	
	public function setInForParameter($ParameterName, $ParameterVale) {
		if (array_key_exists($ParameterName,$this->_gyInFor))
		{
			//已经存在
			$this->_gyInFor[$ParameterName]=$ParameterVale;
		}
		else
		{
			//不存在
			$tempA=array($ParameterName=>$ParameterVale);
			$tempB=$this->_gyInFor;
			$this->_gyInFor=array_merge($tempA,$tempB);
		}
	}
	
	public function GyT() {
		
	}
	
	private function GYReadFile($filename)
	{
		$content=file_get_contents($filename);
		
		if(is_null($this->getGyiCharset())==TRUE)
		{
			$content = iconv($this->getGyiCharset(),"UTF-8//IGNORE",$content); 
		}
		return $content;
	}
	
	public function parse() {
		try {
			$this->setContent($this->GYReadFile($this->_gyFile));
			//处理标签
			$GySplitA=explode($this->_gyFrontSeparator, $this->_gyContent);
			
			if(count($GySplitA)<=1)
			{
				//没有需要处理的变量
			}
			else
			{
				
				for($i=1,$temp_count=count($GySplitA); $i<$temp_count; $i++) {
					$GySplitB=explode($this->_gyBackSeparator, $GySplitA[$i]);
					$this->_gyParameterArray[($i-1)]=$GySplitB[0];
				}
				$this->RepInclude();
				
				// 处理判断
				$this->RepIf();
				
				// 处理循环
				$this->RepFor();
				
				// 处理插件
				//$this->RepPlus();
				
				// 处理替换的标签
				$this->RepString();
			}
		} catch (Exception $e) {
			print $e->getMessage();
			exit;
		}
	}
	
	private function RepInclude(){
		$tempS=$this->_gyContent;
		$tempCountA=count($this->_gyParameterArray);
		$deletekey=array();
		for($i=0;$i<=$tempCountA;$i++)
		{
			if(substr_count($this->_gyParameterArray[$i],"include:")>0)
			{
				//获取包含的文件内容
				$tempPath=str_replace("include:","",$this->_gyParameterArray[$i]);
				$tempContent=$this->GYReadFile(SYSTEM_PATH.$tempPath);
				$tempS=str_replace($this->_gyFrontSeparator.$this->_gyParameterArray[$i].$this->_gyBackSeparator,$tempContent,$tempS);
				$deletekey[]=$this->_gyParameterArray[$i];
			}
		}
		$this->setContent($tempS);
	}
	
	private function RepString() {
		$tempS=$this->_gyContent;
		$tempParameterArray=$this->_gyInVar;
		$tempCountA=count($this->_gyParameterArray);
		$deletekey=array();
		for($i=0;$i<=$tempCountA;$i++)
		{
			//对变量循环,看看有没有符合的变量,符合的进行替换
			if(substr_count($this->_gyParameterArray[$i],":")==0)
			{
				foreach ($tempParameterArray as $key => $value) {
					if($key==$this->_gyParameterArray[$i])
					{
						$tempS=str_replace($this->_gyFrontSeparator.$key.$this->_gyBackSeparator,$value,$tempS);
						$deletekey[]=$key;
						$tempParameterArray=$this->gydeletearraykey($tempParameterArray,$key);		
					}
				}
			}
			
		}
		$this->setContent($tempS);
	}
	
	private function RepIf(){
		$tempS=$this->_gyContent;
		$GySplitA=explode($this->_gyFrontSeparator."endif:", $tempS);
		if(count($GySplitA)<=1)
		{
				//没有需要处理的变量
		}
		else
		{
			for($i=1,$temp_count=count($GySplitA); $i<$temp_count; $i++) {
				$GySplitF=explode($this->_gyFrontSeparator."endif:", $tempS);
				$mainkey="";
				$GySplitB=explode($this->_gyBackSeparator, $GySplitF[1]);
				$mainkey=$GySplitB[0];
				$tempGySplit=$GySplitF[0];
				$GySplitD=explode($this->_gyFrontSeparator."if:", $GySplitF[0]);
				$GySplitE=explode($this->_gyBackSeparator,$GySplitD[(count($GySplitD)-1)]);
				$key=$GySplitE[0];
				$tempSpStart="";
				$tempSpEnd="";
				$tempSpIf="";
				$tempMain_2=explode($this->_gyFrontSeparator."endif:".$mainkey.$this->_gyBackSeparator, $tempS);
							
				for($k=1;$k<count($tempMain_2);$k++)
				{
					$tempSpEnd=$tempSpEnd.$tempMain_2[$k].$this->_gyFrontSeparator."endif:".$mainkey.$this->_gyBackSeparator;
				}
				$tempSpEnd=substr($tempSpEnd,0,strlen($tempSpEnd)-strlen($this->_gyFrontSeparator."endif:".$mainkey.$this->_gyBackSeparator));
							
				//获取第一个
				$tempMain_3=explode($this->_gyFrontSeparator."if:".$key.$this->_gyBackSeparator, $tempMain_2[0]);
				$tempSpIf=$tempMain_3[(count($tempMain_3)-1)];
				for($k=0;$k<(count($tempMain_3)-1);$k++)
				{
					$tempSpStart=$tempSpStart.$tempMain_3[$k].$this->_gyFrontSeparator."if:".$key.$this->_gyBackSeparator;
				}
				$tempSpStart=substr($tempSpStart,0,strlen($tempSpStart)-strlen($this->_gyFrontSeparator."if:".$key.$this->_gyBackSeparator));
				foreach ($this->_gyInIf as $ifkey => $ifvalue) {
					if($mainkey==$ifkey)
					{
						//调用if类进行处理
						$igyif=new GyIf();
						$igyif->setTempValue($ifvalue);
						$igyif->setgyParameter($key);
						$igyif->settempSpStart($tempSpStart);
						$igyif->settempSpEnd($tempSpEnd);
						$igyif->settempSpIf($tempSpIf);
						$igyif->setgyFrontSeparator($this->_gyFrontSeparator);
						$igyif->setgyBackSeparator($this->_gyBackSeparator);
						$igyif->Parse();
						$tempS=$igyif->getContent();
					}
				}
			}
		}

		$this->setContent($tempS);
	}

	private function RepFor(){
		
		$tempS=$this->_gyContent;
		
		$GySplitA=explode($this->_gyFrontSeparator."endfor:", $tempS);
		if(count($GySplitA)<=1)
		{
				//没有需要处理的变量
		}
		else
		{
			for($i=1,$temp_count=count($GySplitA); $i<$temp_count; $i++) {
				$GySplitF=explode($this->_gyFrontSeparator."endfor:", $tempS);
				$mainkey="";
				$GySplitB=explode($this->_gyBackSeparator, $GySplitF[1]);
				$mainkey=$GySplitB[0];
				$tempGySplit=$GySplitF[0];
				$GySplitD=explode($this->_gyFrontSeparator."for:", $GySplitF[0]);
				$GySplitE=explode($this->_gyBackSeparator,$GySplitD[(count($GySplitD)-1)]);
				$key=$GySplitE[0];
				$tempSpStart="";
				$tempSpEnd="";
				$tempSpFor="";
				
				$tempMain_2=explode($this->_gyFrontSeparator."endfor:".$mainkey.$this->_gyBackSeparator, $tempS);	
				for($k=1;$k<count($tempMain_2);$k++)
				{
					$tempSpEnd=$tempSpEnd.$tempMain_2[$k].$this->_gyFrontSeparator."endfor:".$mainkey.$this->_gyBackSeparator;
				}
				$tempSpEnd=substr($tempSpEnd,0,strlen($tempSpEnd)-strlen($this->_gyFrontSeparator."endfor:".$mainkey.$this->_gyBackSeparator));
							
				//获取第一个
				$tempMain_3=explode($this->_gyFrontSeparator."for:".$key.$this->_gyBackSeparator, $tempMain_2[0]);
				$tempSpFor=$tempMain_3[(count($tempMain_3)-1)];
				for($k=0;$k<(count($tempMain_3)-1);$k++)
				{
					$tempSpStart=$tempSpStart.$tempMain_3[$k].$this->_gyFrontSeparator."for:".$key.$this->_gyBackSeparator;
				}
				$tempSpStart=substr($tempSpStart,0,strlen($tempSpStart)-strlen($this->_gyFrontSeparator."for:".$key.$this->_gyBackSeparator));
				foreach ($this->_gyInFor as $forkey => $forvalue) {
					if($mainkey==$forkey)
					{
						$igyfor=new GyFor();
						$igyfor->setTempValue($forvalue);
						$igyfor->setgyParameter($key);
						$igyfor->settempSpStart($tempSpStart);
						$igyfor->settempSpEnd($tempSpEnd);
						$igyfor->settempSpFor($tempSpFor);
						$igyfor->setgyFrontSeparator($this->_gyFrontSeparator);
						$igyfor->setgyBackSeparator($this->_gyBackSeparator);
						$igyfor->Parse();
						$tempS=$igyfor->getContent();
					}
				}
			}
		}
		$this->setContent($tempS);
	}
	
	private function gydeletearraykey($sArray,$key){
		$tempA=$sArray;
		if (array_key_exists($key,$tempA))
		{
			unset($tempA[$key]); 
		}
		return $tempA;
	}
	
	private function gydeletearrayvalue($sArray,$value){
		$tempA=$sArray;
		unset($tempA[array_search($value,$tempA)]);
		return $tempA;
	}
	
	private function gyshuffle($sArray)
	{
		$tempA=$sArray;
		$tempB=array();
		$i=0;
		foreach ($tempA as $key => $value) 
		{
			$tempB[$i]=$value;
			$i++;
		}
		return $tempB;
	}
	
	public function Out(){
		return $this->_gyContent;
	}
}
?>
登录后复制

<?php
class GyFor
{
	private $_content="";//返回值
	private $_gyFrontSeparator = "{";
	private $_gyBackSeparator = "}";
	//private $_gyParameter=array();//主体数组结构由6个变量组成,1主内容。2维度。3start主体。4end主体。5mainkey。6key
	private $_gyParameter="";//表达式
	// 循环前的字符串
	private $_tempSpStart="";
	// 循环后的字符串
	private $_tempSpEnd="";
	// 循环的字符串
	private $_tempSpFor="";
	
	private $_tempValue="";
	
	public function GyFor()
	{
		$this->_content="";
	}
	
	public function setgyFrontSeparator($gyFrontSeparator)
	{
		$this->_gyFrontSeparator=$gyFrontSeparator;
	}
	public function setgyBackSeparator($gyBackSeparator)
	{
		$this->_gyBackSeparator=$gyBackSeparator;
	}
	public function setTempValue($tempValue)
	{
		$this->_tempValue=$tempValue;
	}
	public function setgyParameter($gyParameter)
	{
		$this->_gyParameter=$gyParameter;
	}
	public function settempSpStart($tempSpStart)
	{
		$this->_tempSpStart=$tempSpStart;
	}
	public function settempSpEnd($tempSpEnd)
	{
		$this->_tempSpEnd=$tempSpEnd;
	}
	public function settempSpFor($tempSpFor)
	{
		$this->_tempSpFor=$tempSpFor;
	}
	
	public function Parse()
	{
		if(is_array($this->_tempValue)==true)
		{
			//判断数组维数
			$weidu=$this->arrayLevel($this->_tempValue);
			
			if($weidu==1)
			{
				//如果是1维数组,则直接替换就ok
				foreach ($this->_tempValue as $forkey => $forvalue) {
					$tkey=$this->_gyFrontSeparator.$this->_gyParameter.".".$forkey.$this->_gyBackSeparator;
					$this->_tempSpFor=str_replace($tkey, $forvalue, $this->_tempSpFor);
				}
				$this->_content=$this->_tempSpStart.$this->_tempSpFor.$this->_tempSpEnd;
			}
			elseif($weidu==2)
			{
				
				$tempS="";
				$tempT="";
				//如果是2维数组,则循环替换
				for($i=0,$tc=count($this->_tempValue,0);$i<$tc;$i++)
				{
					$tempT=$this->_tempSpFor;
					foreach ($this->_tempValue[$i] as $forkey => $forvalue) {
						$tkey=$this->_gyFrontSeparator.$this->_gyParameter.".".$forkey.$this->_gyBackSeparator;
						$tempT=str_replace($tkey, $forvalue, $tempT);
					}
					$tempS=$tempS.$tempT;
				}
				$this->_content=$this->_tempSpStart.$tempS.$this->_tempSpEnd;
			}
			else
			{
				$this->_content=$this->_tempSpStart.$this->_tempSpEnd;
			}
		}
		else
		{
			$this->_content=$this->_tempSpStart.$this->_tempSpEnd;
		}
	}
	
	/**
    * 返回数组的维度
    * @param [type] $arr [description]
    * @return [type]     [description]
    */
    function arrayLevel($arr)
    {
	    $al = array(0);
	    
	    $this->aL($arr,$al);
	    return max($al);
    }
	
	function aL($arr,&$al,$level=0)
	    {
		    if(is_array($arr)){
			    $level++;
			    $al[] = $level;
			    foreach($arr as $v)
			    {
			    	$this->aL($v,$al,$level);
			    }
		    }
	    }
	
	public function getContent()
	{
		return $this->_content;
	}
	
}
登录后复制

<?php
class GyIf
{
	private $_content="";//返回值
	private $_gyParameter="";//表达式
	// 循环前的字符串
	private $_tempSpStart="";
	// 循环后的字符串
	private $_tempSpEnd="";
	// 循环的字符串
	private $_tempSpIf="";
	private $_tempValue="";
	
	private $_gyFrontSeparator = "{";
	
	private $_gyBackSeparator = "}";
	
	public function GyIf()
	{
		$this->_content="";
	}
	public function setgyFrontSeparator($gyFrontSeparator)
	{
		$this->_gyFrontSeparator=$gyFrontSeparator;
	}
	public function setgyBackSeparator($gyBackSeparator)
	{
		$this->_gyBackSeparator=$gyBackSeparator;
	}
	public function setTempValue($tempValue)
	{
		$this->_tempValue=$tempValue;
	}
	public function setgyParameter($gyParameter)
	{
		$this->_gyParameter=$gyParameter;
	}
	public function settempSpStart($tempSpStart)
	{
		$this->_tempSpStart=$tempSpStart;
	}
	public function settempSpEnd($tempSpEnd)
	{
		$this->_tempSpEnd=$tempSpEnd;
	}
	public function settempSpIf($tempSpIf)
	{
		$this->_tempSpIf=$tempSpIf;
	}
	
	public function Parse()
	{
		$c_a=$this->_tempSpStart.$this->_tempSpIf.$this->_tempSpEnd;
		$c_b=$this->_tempSpStart.$this->_tempSpEnd;
		
		//对表达式进行分析 判断是否含有空格
		if(substr_count($this->_gyParameter," ")==0)
		{
			//如果不含有表达式,判断当前值的真假
			if(isset($this->_tempValue))
			{
				if($this->_tempValue==true)
				{
					$this->_content=$c_a;
				}
				else
				{
					$this->_content=$c_b;
				}
			}
			else
			{
				$this->_content=$c_b;
			}
		}
		else
		{
			$mainkey=explode(" ", $this->_gyParameter);
	
			if(count($mainkey)==2)
			{
				if($this->_tempValue==$mainkey[1])
				{
					$this->_content=$c_a;
				}
				else
				{
					$this->_content=$c_b;
				}
			}
			else
			{
				$key1=$this->_tempValue;
				$key2=$mainkey[1];//表达式
				$key3=$mainkey[2];
				//echo "<br>------------------<br>";
				//print_r($key2);
				//echo "<br>------------------<br>";
				switch ($key2) 
				{
					case "eq":
						if($key1==$key3)
						{
							$this->_content=$c_a;
						}
						else
						{
							$this->_content=$c_b;
						}
						break;
					case "=":
						if($key1==$key3)
						{
							//echo "<br>--------true----------<br>";
							$this->_content=$c_a;
						}
						else
						{
							//echo "<br>--------false----------<br>";
							$this->_content=$c_b;
						}
						break;
					case ">":
						if($key1 > $key3)
						{
							$this->_content=$c_a;
						}
						else
						{
							$this->_content=$c_b;
						}
						break;
					case ">=":
						if($key1 >= $key3)
						{
							$this->_content=$c_a;
						}
						else
						{
							$this->_content=$c_b;
						}
						break;
					case "<":
						if($key1 < $key3)
						{
							$this->_content=$c_a;
						}
						else
						{
							$this->_content=$c_b;
						}
						break;
					case "<=":
						if($key1 <= $key3)
						{
							$this->_content=$c_a;
						}
						else
						{
							$this->_content=$c_b;
						}
						break;
					default:
						
				}
			}
		}
	}
	
	public function getContent()
	{
		return $this->_content;
	}
}
登录后复制

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>{@#a5#@}</title>
	</head>

	<body>
		{@#include:/s/t/default/head.html#@}
		<br /> 测试变量1 {@#a1#@}
		<br /> {@#include:/s/t/default/head.html#@}
		<br /> {@#a2#@}
		<br /> {@#a3#@}
		<br /> {@#a4#@}
		<br />
		<br /> {@#if:guoyong > 1#@}
		<br />1: {@#a4#@} {@#if:guoyong = 1#@}
		<br />1: {@#a4#@}
		<br /> {@#endif:guoyong#@}
		<br /> {@#endif:guoyong#@}
		<br /> {@#a4#@}
		<br /> {@#if:guoyong 1#@}
		<br />2: {@#a4#@}
		<br /> {@#endif:guoyong#@}
		<br />
		<br /> {@#if:guoyong 1#@}
		<br />3: {@#a4#@}
		<br /> {@#endif:guoyong#@}
		<br /> {@#include:/s/t/default/foot.html#@} {@#for:netlist#@} =====================
		<br>
		<a href="/article.jsp?articleid={@#netlist.Id#@}" title="{@#netlist.Title#@}">{@#netlist.Title#@}</a>
		<br> =============================
		<br> {@#for:netlist1#@}
		<br>
		<a href="/article.jsp?articleid={@#netlist1.Id#@}" title="{@#netlist1.Title#@}">{@#netlist1.Title#@}</a>
		<br> {@#endfor:netlist1#@} {@#endfor:netlist#@}

		<br /> **************************

		<br />
		<br />
		<br />
		<br /> {@#plus:test=fdsafdsafsdafsadfdsfdsafdas#@}
		<br />
		<br />
		<br />
		<br />
		<br />
	</body>

</html>
登录后复制

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

PPT蒙版要怎么添加 PPT蒙版要怎么添加 Mar 20, 2024 pm 12:28 PM

关于PPT蒙版,很多人肯定对它很陌生,一般人做PPT不会将它吃透,而是凑活着可以做出来自己喜欢的就行,所以很多人都不知道PPT蒙版到底是什么意思,也不知道这个蒙版有什么作用,甚至更不知道它可以让图片变得不再那么单调,想要学习的小伙伴们快来了学习学习,为你的PPT图片上添上点吧PPT蒙版吧,让它不再单调了。那么,PPT蒙版要怎么添上呢?请往下看。1.首先我们打开PPT,选择一张空白的图片,之后右键点击【设置背景格式】,纯色选择颜色就行。2.点击【插入】,艺术字,输入字3.点击【插入】,点击【形状】

PHP电子邮件模板:定制化和个性化您的邮件内容。 PHP电子邮件模板:定制化和个性化您的邮件内容。 Sep 19, 2023 pm 01:21 PM

PHP电子邮件模板:定制化和个性化您的邮件内容随着电子邮件的普及和广泛应用,传统的邮件模板已经不能满足人们对个性化和定制化邮件内容的需求。现在,我们可以通过使用PHP编程语言来创建定制化和个性化的电子邮件模板。本文将为您介绍如何使用PHP来实现这一目标,并提供一些具体的代码示例。一、创建邮件模板首先,我们需要创建一个基本的邮件模板。这个模板可以是一个HTM

C++ 模板特化的影响对于函数重载和重写 C++ 模板特化的影响对于函数重载和重写 Apr 20, 2024 am 09:09 AM

C++模板特化影响函数重载和重写:函数重载:特化版本可提供特定类型不同的实现,从而影响编译器选择调用的函数。函数重写:派生类中的特化版本将覆盖基类中的模板函数,影响派生类对象调用函数时的行为。

引擎格局变革:三缸发动机挑战六缸和八缸统治地位 引擎格局变革:三缸发动机挑战六缸和八缸统治地位 Oct 08, 2023 pm 10:57 PM

10月8日消息,美国汽车市场正在经历一场引擎盖下的变革,以前备受喜爱的六缸和八缸动力发动机正逐渐失去统治地位,而三缸发动机则崭露头角。10月8日的消息显示,美国汽车市场正在经历一场引擎盖下的变革。过去备受喜爱的六缸和八缸动力发动机正在逐渐失去统治地位,而三缸发动机则开始崭露头角在大多数人的印象中,美国人钟情于大排量车型,而"美式大V8"一直是美国车的代名词。然而,根据外媒近期公布的数据,美国汽车市场的格局正在发生巨大变化,引擎盖下的战斗正愈演愈烈。据了解,在2019年之前,美

C++中的模板元编程面试常见问题 C++中的模板元编程面试常见问题 Aug 22, 2023 pm 03:33 PM

C++是一门广泛应用于各个领域的编程语言,其模板元编程是一种高级编程技术,可让程序员在编译时对类型和数值进行变换。在C++中,模板元编程是一个广泛讨论的话题,因此在面试中,与此相关的问题也是相当常见的。以下是一些可能会被问到的C++中的模板元编程面试常见问题。什么是模板元编程?模板元编程是一种在编译时操作类型和数值的技术。它使用模板和元函数来根据类型和值生成

如何在 OneNote 中使用模板来提高工作效率 如何在 OneNote 中使用模板来提高工作效率 Apr 30, 2023 am 11:31 AM

您是否知道使用模板可以提高记笔记的速度以及捕捉重要想法的效率?OneNote有一套现成的模板供您使用。最好的部分是您还可以根据需要设计模板。无论您是学生、企业战士还是从事创造性工作的自由职业者。OneNote模板可用于以适合您风格的结构和格式记录重要笔记。模板可以是记笔记过程的大纲。业余爱好者只是做笔记,专业人士则在模板的帮助下通过结构良好的笔记做笔记并从中汲取联系。让我们看看如何在OneNote中使用模板。使用默认OneNote模板第1步:按键盘上的Windows R。键入Oneno

Flask-Bootstrap:为Flask应用程序添加模板 Flask-Bootstrap:为Flask应用程序添加模板 Jun 17, 2023 pm 01:38 PM

Flask-Bootstrap:为Flask应用程序添加模板Flask是一个轻量级的PythonWeb框架,它提供了一个简单而灵活的方式来构建Web应用程序。它是一款非常受欢迎的框架,但它的默认模板功能有限。要创建富有吸引力的用户界面,需使用其他框架或库。这就是Flask-Bootstrap的用武之地。Flask-Bootstrap是一个基于Twitter

实测英伟达AI游戏引擎:与NPC实时聊天,中文流畅爆了 实测英伟达AI游戏引擎:与NPC实时聊天,中文流畅爆了 Mar 04, 2024 am 09:40 AM

黄院士在《赛博朋克2077》里搞的智能NPC,已经飙起中文了?量子位的一手体验,亲眼见证了NPC们流利地用中英双语对话,表情动作自然,口型也能对上……如果不是眼前就有一块屏幕,真的会有种身临其境之感。今年的CES展会上,英伟达用智能引擎AvatarCloudEngine(ACE),让游戏NPC“活”了起来,引起了不小的震撼。△CES上展示的智能NPC使用ACE,游戏中的角色可以与玩家进行逼真的语音对话,同时展现出生动的表情和肢体动作,而无需提前准备剧本。亮相当时,就有育碧、腾讯、网易、米哈游等国

See all articles