TP5 教程持续更新中

TP5.1下载用composer下载,如果下载太慢,请用阿里云镜像: 

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/  

composer下载命令:

composer create-project topthink/think=5.1.* tp5
http://tp5.com/index.php/demo/index/hello
 
      1                 2              3          4        5
       1                 2              3                4                5
   主机名字  /index.php/应用名字/控制器名字/方法名(默认index)
 
TP5 的 Apache伪静态:

<IfModule mod_rewrite.c>

Options +FollowSymlinks -Multiviews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]

</IfModule>

 TP5的Nginx伪静态:

location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }

1. TP5.1/public/index.php
文件中:
//执行应用并反应
Container::get('app')->bind('demo')->run->send();
bind('demo') 代表指定应用 同理可以bind('demo/index')
这时候无法打开其他应用,而且打开demo应用的时候,
直接输入 tp55.com/index/abd 不用再输入应用名称
tp55.com/demo/index/abd

2.
config/app.php
文件中 :
//是否支持多模块
'app_multi_module '=> false, //代表不支持多模块

app目录那边 application/controller/Index.php 命名空间写 namespace appcontroller;


3.

return Env::get('app_path');


4.
受保护的
protected function initalize()
{

}

原文地址:https://www.cnblogs.com/79524795-Tian/p/14201421.html