私は次のようにbase_url()をエコーしようとしています:
editor_header.php
<link href="<?php echo base_url(); ?>/css/bootstrap.css" rel="stylesheet" media="screen">
editor_header.phpのコントローラーは次のようになります。
<?php
class Pages extends CI_Controller {
public function view($page = 'home')
{
if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('head&foot/editor_header', $data);
}
}
?>
autoload.phpでurl_helperを有効にしました
$autoload['helper'] = array('url');
しかし、それでもエラーが発生します。
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /Applications/XAMPP/xamppfiles/htdocs/editor/application/controllers/pages.php on line 5
pages.phpは上記のコントローラーです。
私の質問
editor_header.phpがbase_urlを使用できない理由を誰かにアドバイスできますか?前もって感謝します。