smarty 引用php类,smarty 的PHP引用
摘要:<?phpsession_start ();//改時區date_default_timezone_set("PRC");//引入模板引擎require 'smarty.init.php';//對象class test{public $site="php中文網";public function welcome(){return &
session_start();
//改時區
date_default_timezone_set("PRC");
//引入模板引擎
require 'smarty.init.php';
//對象
class test{
public $site="php中文網";
public function welcome()
{
return "歡迎來到".$this->site;
}
}
$test=new test();
//函數方法
function add($a,$b)
{
return $a+$b;
}
//常量 不需要賦值
const NAME="php中文網";
$_POST['user']="管理員";
// $_GET['id']=5;
$_SESSION['pass']=md5('123456');
//賦值
$smarty->assign("test",$test);
$prov="jiangsu";
//模板賦值 字符串 布爾型 數值 數組 對象 常量 自定義函數 系統變量等
// $smarty->assign("sheng",$prov);
//模板文件
$smarty->display("index.html");
// $pdo=new PDO("mysql:host=127.0.0.1;dbname=tk181","root","root");
// $sql="select * from stu_info";
// $stat=$pdo->query($sql)->fetchAll(2);
// print_r($stat);
批改老師:歐陽批改時間:2019-05-16 09:29:31
老師總結:完成的不錯。php框架多學習幾種,對以后工作有幫助,繼續加油。
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的smarty 引用php类,smarty 的PHP引用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在python中求小于100的所有合数_
- 下一篇: sox处理mp3_音频处理常用Linux