Home > php教程 > php手册 > body text

ZenTaoPHP部署框架自带的简单的blog示例

WBOY
Release: 2016-06-21 08:50:23
Original
1028 people have browsed it

ZenTaoPHP框架中自带了一个简单的blog示例,下面让我们来部署这个示例应用。

一、创建数据库

在app/demo/db目录下面,有一个blog.sql。这是一个非常简单的表结构,使用phpmyadmin,或者是命令行的mysql工具,创建一个数据库,叫做blog,然后把这个sql文件里面的建表工具导入。

$> mysql -u root -p
$> create database blog;

 

二、创建应用的配置文件

在我们的代码中,已经内置了一个config.php文件,可以直接修改这个配置文件,但是我们建议的方式是创建一个my.php,将当前应用相关的配置在这个my.php文件中重新定义。这样可以解决代码冲突的问题。

将app/demo/config/my.example.php文件,复制为my.php,然后修改其中的数据库访问参数。

$config->debug = true;                      // 开发环境,可以将debug打开。
$config->requestType = 'PATH_INFO'; // 如果apache打开了mod_rewrite,可以用这个选项。如果不行,则改用GET
$config->requestFix = '-';                   // 路径分隔符。
$config->webRoot = '/zentaophp/app/demo/www/';    // 当前应用的根路径,也就是index.php所在的路径。

$config->db->host = 'localhost';
$config->db->port = '3306';
$config->db->name = 'blog';
$config->db->user = 'root';
$config->db->password = '';

三、访问blog应用。

http://localhost/zentaophp/app/demo/www/blog,即可看到界面了。

(作者:禅道)



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!