TP5 + 小程序全栈准备工作

工具:Xampp、thinkphp5.07、phpstorm、Xdebug(这个配置好了一直不能使用,求高手解答)、postMan、navicat

准备

一、配置tp框架        框架放入htdocs,改名为zerg,核心框架移动到zerg内

二、配置虚拟域名     apache\conf\extra\httpd-vhosts.conf  

       

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/zerg/public"
    ServerName www.tp5.com
</VirtualHost>

     配置虚拟域名后还需要     配置host

127.0.0.1	localhost
127.0.0.1   www.tp5.com

三、URL三中访问模式

PATH_INFO        http://www.tp5.com/index/index/index
混合模式          多个请求既可以是PATH_INFO又可以是路由模式
强制使用路由模式   http://www.tp5.com/index

        强制使用路由需要配置路由之后才能使用

           路由还可以定义请求方式,或者使用请求方式定义路由

四、获取参数

方式一、 直接在参数获取
public function index($a,$b)
{
   $a = 10;
   $b = 15 ;
   echo $a;
   echo $b;
}

方式二、 Request获取参数
$all = Request::instance() -> post();
$all = Request::instance() -> route();
$all = Request::instance() -> get();
$all = Request::instance() -> param();
$id = Request::instance() -> param('id');
$name = Request::instance() -> param('name');
$age = Request::instance() -> param('age');
var_dump($all);

方式三、 助手函数
$all = input('param.');
$all = input('get.name.');
$all = input('post.name.');

附、 依赖注入
public function test(Request $request){
$all = $request -> param();
var_dump($all);
}

五、配置phpstorm + Xdebug  进行断点调试

        这一步失败了   

        使用phpinfo()去下载Xdebug,然后将下载的文件放到C:\xampp\php\ext,在配置php.ini

[Xdebug]
zend_extension ="C:\xampp\php\ext\php_xdebug-2.9.2-7.3-vc15.dll"
xdebug.remote_autostart=1 
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
xdebug.remote_port=9000
xdebug.remote_host="localhost"
xdebug.idekey="PHPSTORM"

          再去配置phpstorm的

         总结: 个人感觉不好用是因为版本太高。

六、phpstorm配置     自动填充命名空间

       配置

       效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值