手记

微信小程序tp5开发(2) 环境的搭建

假设您已安装了composer ,使用composer安装tp5用下面的命令
composer create-project topthink/think project --prefer-dist

目录给结为:
D:.
├─application
│ └─index
│ └─controller
├─extend
├─public
│ └─static
├─runtime
├─thinkphp
│ ├─lang
│ ├─library
│ │ ├─think
│ │ │ ├─cache
│ │ │ │ └─driver
│ │ │ ├─config
│ │ │ │ └─driver
│ │ │ ├─console
│ │ │ │ ├─bin
│ │ │ │ ├─command
│ │ │ │ │ ├─make
│ │ │ │ │ │ └─stubs
│ │ │ │ │ └─optimize
│ │ │ │ ├─input
│ │ │ │ └─output
│ │ │ │ ├─descriptor
│ │ │ │ ├─driver
│ │ │ │ ├─formatter
│ │ │ │ └─question
│ │ │ ├─controller
│ │ │ ├─db
│ │ │ │ ├─builder
│ │ │ │ ├─connector
│ │ │ │ └─exception
│ │ │ ├─debug
│ │ │ ├─exception
│ │ │ ├─log
│ │ │ │ └─driver
│ │ │ ├─model
│ │ │ │ └─relation
│ │ │ ├─paginator
│ │ │ │ └─driver
│ │ │ ├─process
│ │ │ │ ├─exception
│ │ │ │ └─pipes
│ │ │ ├─response
│ │ │ ├─session
│ │ │ │ └─driver
│ │ │ ├─template
│ │ │ │ ├─driver
│ │ │ │ └─taglib
│ │ │ └─view
│ │ │ └─driver
│ │ └─traits
│ │ ├─controller
│ │ ├─model
│ │ └─think
│ └─tpl
└─vendor
├─composer
└─topthink
└─think-installer
└─src
application是我们应用程序的保存目录,命名规则要按约定进行。
vendor是第三方的模块。
public则是我们运行目录 。
入口文件是目录的public 下的 index.php

<?php
//
+----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
//
+----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
//
+----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
//
+----------------------------------------------------------------------
// | Author: liu21st liu21st@gmail.com
//
+----------------------------------------------------------------------

// [ 应用入口文件 ]

// 定义应用目录
define('APP_PATH', DIR . '/../application/');
// 加载框架引导文件
require DIR . '/../thinkphp/start.php';

我们用tp5内置的SERVER进行开发。

PS D:\thinkphp5\shop> cd .\public\
PS D:\thinkphp5\shop\public> php -S localhost:8090 router.php
PHP 5.6.14 Development Server started at Wed Aug 30 16:28:44 2017
Listening on http://localhost:8090
Document root is D:\thinkphp5\shop\public
Press Ctrl-C to quit.
运行起来了

2人推荐
随时随地看视频
慕课网APP