安装thinkphp5

一.git安装(git可以保持最新版本)

1.thinkphp 的github 代码版本地址:https://github.com/top-think

thinkPHP5.0 拆分为多个仓库,主要包括:
应用项目:https://github.com/top-think/think
核心框架:https://github.com/top-think/framework

[ 码云 ](国内)

应用项目:https://gitee.com/liu21st/thinkphp
核心框架:https://gitee.com/liu21st/framework

[ Coding ](国内)

应用项目:https://git.coding.net/liu21st/thinkphp5.git
核心框架:https://git.coding.net/liu21st/framework.git

2.打开Git终端 切换到需要安装的目录,克隆下载应用项目仓库

git clone --depth=1 https://github.com/top-think/think.git think_git
--depth=1 代表 不下载历史版本   去除即下载全部版本   后面跟地址 think_git为安装的目录

git clone https://gitee.com/liu21st/thinkphp think_git

因为核心框架还没下载,所以报错

 3.切换到think_git目录,并克隆核心框架仓库

cd think_git/
git clone --depth=1 https://github.com/top-think/framework.git thinkphp

git clone https://gitee.com/liu21st/framework thinkphp

 可看到此时核心框架版本是tp6.0,再看看其他版本。

 这是应用项目的版本

可是安装了thinkphp核心目录还是出现上述错误,这是因为尽管你已经下载了Thinkphp框架代码并且把他放入到你的web服务器上,但是这里仍然缺少了依赖性。为了能够让Thinkphp正常运行,应该安装这些缺少的依赖。

解决办法:

为了解决这个错误,你需要使用composer去安装缺少的依赖。Composer是PHP的一个依赖性包管理工具。如果你的系统中还没有安装composer,你需要第一时间安装它。你可以去官网下载composer: https://getcomposer.org.然后配置composer全局环境变量。

在安装的目录下打开命令行输入:

composer install

 会出现composer.lock文件

 此时就可以访问了

 4.版本回退

回退到5.0版本

git checkout 5.0

但是会报错,不知道怎么解决

二.composer 安装

是 PHP 用来管理依赖(dependency)关系的工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件。

1.打开中文网:https://packagist.org/

 2.输入:topthink,找到topthink/think

3.进行命令的复制 composer create-project topthink/think 

4.安装指定版本 composer create-project topthink/think 安装目录的名字  5.0.*  

 看一下每个版本里的composer.json的区别

tp5.0

{
    "name": "topthink/think",
    "description": "the new thinkphp framework",
    "type": "project",
    "keywords": [
        "framework",
        "thinkphp",
        "ORM"
    ],
    "homepage": "http://thinkphp.cn/",
    "license": "Apache-2.0",
    "authors": [
        {
            "name": "liu21st",
            "email": "liu21st@gmail.com"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "topthink/framework": "5.0.*"
    },
    "autoload": {
        "psr-4": {
            "app\": "application"
        }
    },
    "extra": {
        "think-path": "thinkphp"
    },
    "config": {
        "preferred-install": "dist"
    }
}

tp5.1

{
    "name": "topthink/think",
    "description": "the new thinkphp framework",
    "type": "project",
    "keywords": [
        "framework",
        "thinkphp",
        "ORM"
    ],
    "homepage": "http://thinkphp.cn/",
    "license": "Apache-2.0",
    "authors": [
        {
            "name": "liu21st",
            "email": "liu21st@gmail.com"
        }
    ],
    "require": {
        "php": ">=5.6.0",
        "topthink/framework": "5.1.*"
    },
    "autoload": {
        "psr-4": {
            "app\": "application"
        }
    },
    "extra": {
        "think-path": "thinkphp"
    },
    "config": {
        "preferred-install": "dist"
    }
}

tp6.0

{
    "name": "topthink/think",
    "description": "the new thinkphp framework",
    "type": "project",
    "keywords": [
        "framework",
        "thinkphp",
        "ORM"
    ],
    "homepage": "http://thinkphp.cn/",
    "license": "Apache-2.0",
    "authors": [
        {
            "name": "liu21st",
            "email": "liu21st@gmail.com"
        }
    ],
    "require": {
        "php": ">=7.1.0",
        "topthink/framework": "^6.0.0",
        "topthink/think-orm": "^2.0"
    },
    "require-dev": {
        "symfony/var-dumper": "^4.2",
        "topthink/think-trace":"^1.0"
    },
    "autoload": {
        "psr-4": {
            "app\": "app"
        },
        "psr-0": {
            "": "extend/"
        }
    },
    "config": {
        "preferred-install": "dist"
    },
    "scripts": {
        "post-autoload-dump": [
            "@php think service:discover",
            "@php think vendor:publish"
        ]
    }


使用PHPstorm以及PortableGit自带的Git工具,进行版本控制的搭建
https://www.kancloud.cn/mikkle/thinkphp5_study/557901

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注