Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel安装与测试 #1

Open
suhao opened this issue May 10, 2022 · 0 comments
Open

Laravel安装与测试 #1

suhao opened this issue May 10, 2022 · 0 comments

Comments

@suhao
Copy link
Member

suhao commented May 10, 2022

一. 简介

Laravel是基于经典的MVC架构

  • M: Model, 数据库操作,也包括队列,缓存等
  • V: View, 视图, 由一个或多个模板组成,格式化输出响应的数据
  • C: Controller, 控制器, 主要是接受请求,选择模型, 渲染视图等

基于如上架构规则,我们可以猜到,一个网址输入应该是派发到Controller的路由中,然后来返回页面数据

二. 前导知识

  • PHP 基本语法, 特别是面向对象, 命名空间,接口,PDO等
  • HTML,CSS,JavaScript, jQuery 等前端必备技能
  • Composer: php包依赖管理器, 可暂时理解为php应用商店的安装器

三. 安装

  • PHP集成开发环境:推荐Laragon
  • Laragon安装:一键傻瓜式安装
  • Composer安装
    • composer selfupdate`: 将composer更新到最新版本
    • composer clear-cache: 清除之前下载过的本地缓存
    • composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    • composer create-project laravel/laravel laravel

四、环境配置

  1. 启动Nginx, MySQL,PHP服务
  2. 创建网站,域名为laravel.dev.tt
  3. 域名绑定到项目目录WWW/blog/public(public是Laravel可访问目录)
  4. 更新本地host文件,绑定域名与本机IP
  5. 重启Nginx

推荐使用Laragon自动化安装和配置网站环境,前期学习把主要精力放在学习代码和开发上,而不是去搞乱七八糟的环境配置

五、启动测试

打开浏览器,访问laravel.dev.tt

@suhao suhao pinned this issue May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant