smarty 的PHP引用

Original 2019-05-15 17:54:54 180
abstract:<?phpsession_start();//改时区date_default_timezone_set("PRC");//引入模板引擎require 'smarty.init.php';//对象class test{ public $site="php中文网"; public function welcome() { return &

<?php

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);


Correcting teacher:查无此人Correction time:2019-05-16 09:29:31
Teacher's summary:完成的不错。php框架多学习几种,对以后工作有帮助,继续加油。

Release Notes

Popular Entries