1.1.13版本的操作:通过命令行创建一个商场系统(shop)
通过如上命令创建一个商场系统(shop)后,yiitest目录下自动生成shop目录
下面我们来看一下刚创建的商城系统(shop)下的protected目录
访问刚创建的商城系统(shop):
http://localhost/yiitest/shop/index.php
访问效果:
要注意上述访问地址,我们服务器配置的网站根目录是D:\PHP\workspace\test,而框架及应用文件在D:\PHP\workspace\test\yiitest目录下
接下来我们既可以在上述目录结构的基础上进行相应的开发(自定义控制器、视图、模型)
================================================================================
shop改动示例:
参照:《Yii1.1和PHP5进行敏捷Web开发(中文版)》
当我们在一个页面中添加超链接跳转到另一个页面,根据网站目录结构,超链接的地址写法有异
控制器:
视图:
基于上面创建的shop应用,下面代码的超链接地址如果缺少yiitest则访问出错
<?php
$this->breadcrumbs=array(
‘Message‘=>array(‘message/index‘),
‘HelloWorld‘,
);?>
<h1><?php echo $this->id . ‘/‘ . $this->action->id; ?></h1>
<h1>Hello, World!</h1>
<h3><?php echo $time; ?></h3>
<a href="/yiitest/shop/index.php?r=message/goodbye">Goodbye!</a>
<p>You may change the content of this page by modifying the file <tt><?php echo __FILE__; ?></tt>.</p>
访问:http://localhost/yiitest/shop/index.php?r=message/helloworld
显示如下:
原文:http://www.cnblogs.com/studyLog-share/p/4998184.html