( php ) SmartyのURL取得に使用する予約変数のまとめ 【$smarty.server.KEY】
●Webブラウザで閲覧しているページ
https://accentplus.blog134.fc2.com/category1/index.php?id=123
●環境とブラウザ
OS:Windows ブラウザ:IE8でサイトを閲覧
$smarty.server.SERVER_NAME
ホスト名を取得
accentplus.blog134.fc2.com
$smarty.server.SCRIPT_NAME
ルートディレクトリからファイル名までを取得
/category1/index.php
$smarty.get.id
クエリの値を取得
123
$smarty.server.HTTPS
httpの場合はNULL、httpsの場合はon
on
$smarty.env.PATH
環境変数"PATH"の値を表示
/sbin:/usr/sbin:/bin:/usr/bin
$smarty.server.HTTP_USER_AGENT
バージョン番号とプラットフォーム名を含んだ、ブラウザーの名称を取得
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; .…)
※MSIE 8.0 = Microsoft Internet Explorer 8.0
Windows NT 5.1 = Windows XP
$smarty.server.KEYのKEY値を色々と変えることで、サーバー変数を取得することができます。