サマリー:<?phpsession_start();//改時區(qū)date_default_timezone_set("PRC");//引入模板引擎require 'smarty.init.php';//對象class test{ public $site="php中文網(wǎng)"; public function welcome() { return &
<?php
session_start();
//改時區(qū)
date_default_timezone_set("PRC");
//引入模板引擎
require 'smarty.init.php';
//對象
class test{
public $site="php中文網(wǎng)";
public function welcome()
{
return "歡迎來到".$this->site;
}
}
$test=new test();
//函數(shù)方法
function add($a,$b)
{
return $a+$b;
}
//常量 不需要賦值
const NAME="php中文網(wǎng)";
$_POST['user']="管理員";
// $_GET['id']=5;
$_SESSION['pass']=md5('123456');
//賦值
$smarty->assign("test",$test);
$prov="jiangsu";
//模板賦值 字符串 布爾型 數(shù)值 數(shù)組 對象 常量 自定義函數(shù) 系統(tǒng)變量等
// $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框架多學(xué)習(xí)幾種,對以后工作有幫助,繼續(xù)加油。