私は自分で作った PHP CMS を使用しています。$_GET パラメータurl
をフェッチし、それを に変換しwww.website.com/{url}
ます。この CMS は、$_GET パラメータを使用してファイルを取得します。したがって、 が の場合、url
CMSindex
はファイルを検索し、ファイルindex
の内容を返します。しかし今、私は CMS を拡張して、 のような追加パラメータを持たせていますprofile/{username}
。どうすればそれを拡張できますか?URL にwww.website.com/profile/{username}
. どうすればこれを行うことができますか?これは私の現在のhtaccessです:
RewriteEngine On
RewriteRule ^(|/)$ index.php?url=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1a
これがTPLシステムです。
public function addTpl() {
global $zip;
if(!isset($_GET['url']) || empty($_GET['url'])) {
$_GET['url'] = 'index';
}
if(file_exists('_zip/_templates/_front/'. $zip['Template']['Front'] . '/')) {
if(file_exists('_zip/_templates/_front/'. $zip['Template']['Front'] . '/' . secure($_GET['url']) . '.php')) {
ob_start();
include('_zip/_templates/_front/'. $zip['Template']['Front'] . '/' . secure($_GET['url']) . '.php');
$this->tpl .= ob_get_contents();
ob_end_clean();
} else {
die(zipError('File Not Found', 'The file <b>' . secure($_GET['url']) . '</b> could not be found. Please re-check the URL; If you were directed here using a link, please report that link.'));
}
} else {
die(zipError('Template Not Found', 'The template <b>' . $zip['Template']['Front'] . '</b> could not be found. Please check your configuration file for a mistake.'));
}
}
他に提供する必要がある情報はありますか? 私はこれをできるだけ早く終わらせる必要があるので、アドバイスをいただければ幸いです。