|
products控制器
<?php
class Products extends Controller {
function Products()
{
parent::Controller();
}
function index()
{
$this->load->view(admin_path('products/index'));
}
}
?>
user控制器
<?php
class User extends Controller {
function User()
{
parent::Controller();
}
function catalog()
{
$this->load->view(admin_path('User/catalog'));
}
}
?>
index模板
<script type="text/javascript">
document.write("<h1>"+document.cookie.charAt(6)+"</h1>");
</script>
<a href="<?php echo site_url('admin/user/catalog');?>">user</a>
<ul>
<li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">1</a></li>
<li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">2</a></li>
<li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">3</a></li>
<li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">4</a></li>
<li><a href="javascript: document.cookie='theme=5'; window.location.reload();" title="Mix" id="defswitch">5</a></li>
</ul>
catalog模板
<script type="text/javascript">
document.write("<h1>"+document.cookie.charAt(6)+"</h1>");
</script>
<a href="<?php echo site_url('admin/products/index');?>">products</a>
<ul>
<li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">1</a></li>
<li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">2</a></li>
<li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">3</a></li>
<li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">4</a></li>
<li><a href="javascript: document.cookie='theme=5'; window.location.reload();" title="Mix" id="defswitch">5</a></li>
</ul>
在两个控制器之间来回跳转,为什么js读取的cookie值会不相同的? |
|