安装好框架之后,让我们来用框架来实现helloworld!
更多禅道详情尽在:http://www.zentao.net/
我们以框架代码部署在**/var/www/zentaophp**为例:
一、创建应用目录:
在框架的目录下面,有一个app目录,在这个app目录下面创建helloworld目录。
$> mkdir helloworld
**二、创建框架的目录结构
**
框架典型的三个目录,config, module, www, 分别存放配置文件,模块文件,以及入口文件、样式表、js文件、图片等。
$> cd helloworld;
$> mkdir config module www
**三、拷贝配置文件
**
框架运行需要一个主配置文件。这个文件从demo应用里面拷贝一个过来即可。
$> cd config;
$> cp ../../demo/config/config.php ./
**四、创建入口文件。
**
框架运行需要一个入口文件,一般我们是将其存为www/index.php。
在www目录下面编辑index.php文件,写入下面的代码
<?php include '../../../framework/router.class.php'; include '../../../framework/control.class.php'; include '../../../framework/model.class.php'; include '../../../framework/helper.class.php'; $app = router::createApp('**helloworld**'); $app->parseRequest(); $app->loadModule(); ### 五、创建index模块 下面我们在module目录创建index模块。 **$> cd module; $> mkdir index;** **[](https://www.oschina.net/action/GoToLink?url=http%3A%2F%2Fdevel.zentao.net%2Fdata%2Fupload%2F201105%2F2811405803063b4b.gif)** ### 六、创建control.php文件。 在index模块下面,编辑control.php,写入下面的代码: <?php class index extends control { public function \_\_construct() { parent::\_\_construct(); } public function index() { echo 'helloword'; } } ### 七、访问helloworld应用: 这时用浏览器访问:**http://localhost/zentaophp/app/helloworld/www/index.php,**就可以看到hellworld了。

