SmartyでGETの値を取得@PHP
SmartyでGETの値を取得を取得します。
以下は、test.php?id=***&name=***
の時に、パラメータの値を取得します。
{$smarty.get.id}、{$smarty.get.name}で値を取得できます。
test.php
<?php
//Smartyライブラリ
require '../libs/Smarty.class.php';
//生成
$smarty = new Smarty;
//テンプレート「test.tbl」を呼び出して表示
$smarty->display('test.tpl');
?>
|
test.tbl
<html>
<head>
</head>
<body>
ID:{$smarty.get.id} <BR>
NAME:{$smarty.get.name}
</body>
</html>
|