我一直在修改 echo 语句以使我的注销按钮打印在我的标题中(当用户登录时),但我总是遇到这种性质的错误:
解析错误:语法错误,意外的 T_ECHO,期待 ',' 或 ';' 在 /vagrant/web/Project/application/views/_header.php 第 19 行调用堆栈:0.0013 634608 1. {main}() /vagrant/web/Project/index.php:0 0.0123 636728 2. require_once('/ vagrant/web/Project/system/core/CodeIgniter.php') /vagrant/web/Project/index.php:202 0.1486 1025392 3. call_user_func_array() /vagrant/web/Project/system/core/CodeIgniter.php:359 0.1486 1025528 4. Fp_controller->index() /vagrant/web/Project/system/core/CodeIgniter.php:0 0.1486 1025976 5. Viewlib->loadview() /vagrant/web/Project/application/controllers/fp_controller.php :12 0.1487 1026192 6. CI_Loader->view() /vagrant/web/Project/application/libraries/Viewlib.php:16 0.1487 1027600 7. CI_Loader->_ci_load() /vagrant/web/Project/system/core/Loader .php:419
或者 url 将完全搞砸(它实际上将具有“base_url();”而不是我在配置文件中声明的实际基本 url 名称。有人可以帮助我吗?
标题视图
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Final Project Incorporated</title>
</head>
<body>
<h1>Navigation:</h1>
<ul>
<li><a href="<?php echo base_url(); ?>fp_controller/index">Home</a></li>
<li><a href="<?php echo base_url(); ?>fp_controller/directory">Employee Directory</a></li>
<li><a href="<?php echo base_url(); ?>fp_controller/form">Add Employee Form</a></li>
<li><a href="<?php echo base_url(); ?>fp_controller/login">Login</a></li>
<?php
if ($this->session->userdata('isLoggedIn')) {
Line 19>>>> echo "<li>" . "<a href=" . "'" echo base_url();"'" . "fp_controller/logout" . ">" . "Logout" . "</a>" . "</li>";
}
?>
</ul>
<hr />
</body>
</html>