あなたが好きな、機能を使用することができます:あなたは$パス[ 'call_partsを']エコーができ
<?php
$path = get_path(); // I forgot to add this 1st time
if($path['call_parts'][0] == 'your page'){
//do something
} else {
//do something else
} ?>
:
<?php
function get_path() {
$path = array();
if (isset($_SERVER['REQUEST_URI'])) {
$request_path = explode('?', $_SERVER['REQUEST_URI']);
$path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/');
$path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1);
$path['call'] = utf8_decode($path['call_utf8']);
if ($path['call'] == basename($_SERVER['PHP_SELF'])) {
$path['call'] = '';
}
$path['call_parts'] = explode('/', $path['call']);
$path['query_utf8'] = urldecode($request_path[1]);
$path['query'] = utf8_decode(urldecode($request_path[1]));
$vars = explode('&', $path['query']);
foreach ($vars as $var) {
$t = explode('=', $var);
$path['query_vars'][$t[0]] = $t[1];
}
}
return $path;
}
?>
あなたはよりのような関数を呼び出すことができます配列を使用して、正確に何を呼び出す必要があるかを確認します。
<?php
echo '<pre>';
print_r($path);
echo '</pre>';
?>
旧バージョンには存在しない機能はどれですか?古いバージョンはどれですか?グリッド構文(例えば、 'col-sm-12'とは対照的に' span12'など)のためだけであれば、CMSテンプレート/ビューを更新するほうが簡単でしょうか? –
[document.writeを含む可能性があるsrcでスクリプトタグを動的に追加する]の可能な複製(http://stackoverflow.com/questions/13121948/dynamically-add-script-tag-with-src-that-may-include-document -書きます) – zero298