base_url()函數在codeigniter中不起作用我正在使用codeigniter開發我們的應用程序。我試圖使用base_url()函數,但它顯示空結果。我通過自動加載文件使用了autoload helper,但是它似乎也沒有用。我也定義了基本常量,但都是徒勞的。請幫忙。<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="<?php echo base_url();?>/css/template/default.css" type="text/css" /> <script type="text/javascript">
//<![CDATA[
base_url = '<?= base_url();?>';
//]]>
</script>
</head>
3 回答

慕容森
TA貢獻1853條經驗 獲得超18個贊
我認為你還沒有編輯codeigniter文件來啟用base_url()。你嘗試在url_helper.php中分配它,你也可以做同樣的config / autoload.php文件。您可以在autoload.php中添加此代碼
$autoload['helper'] = array('url');
你可以像這樣使用base_url()
<link rel="stylesheet" href="<?php echo base_url();?>/css/template/default.css" type="text/css" />
添加回答
舉報
0/150
提交
取消