PHP速学教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
模板model1.htm代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
模板1 | 模板2 | {$title} {$content} |
模板model2.htm代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
模板1 | 模板2 | {$title} {$content} |
模板model3.htm代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
模板1 | 模板2 | {$title} {$content} |
php页面实现:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
require 'libs/Smarty.class.php'; //包含Smarty类库文件 $smarty = new Smarty; //创建一个新的Smarty对象 $title = "Test"; $content = "This is a test!"; $smarty->assign("title",$title); //对模版中的变量赋值 $smarty->assign("content",$content); //对模版中的变量赋值 if(!isset($_GET['model'])) //根据参数选择不同的模板 { $smarty->display('model1.htm'); } else { if(file_exists('templates/'.'model'.$_GET['model'].'.htm')) //判断模板文件是否存在 { $smarty->display('model'.$_GET['model'].'.htm'); } else { echo "模板参数不正确!"; } } ?> |
php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!
已抢6799个
抢已抢91603个
抢已抢14417个
抢已抢50597个
抢已抢190548个
抢已抢86251个
抢