聊聊valet是否有适合TP5的驱动?

 4085

下面给大家介绍关于valet是否有适合thinkphp5的驱动的问题,希望对需要的朋友有所帮助!

valet 有没有适合thinkphp5的驱动?

觉得valet的思路很好所以采用了这个来做环境。

公司里面用thinkphp的人比较多。所以要使用thinkphp。(而且我是弄前端的,后端用啥也不会特别在意)

https://github.com/curder/blog/blob/master/tools/valet_support_thinkphp.md

这是thinkphp3-valet的。


自己简单写了一个现在试的可以用。

  1. <?php
  2. class ThinkPHP5ValetDriver extends ValetDriver
  3. {
  4.     /**
  5.      * Determine if the driver serves the request.
  6.      *
  7.      * @param  string  $sitePath
  8.      * @param  string  $siteName
  9.      * @param  string  $uri
  10.      * @return bool
  11.      */
  12.     public function serves($sitePath, $siteName, $uri)
  13.     {
  14.         return true;
  15.     }
  16.     /**
  17.      * Determine if the incoming request is for a static file.
  18.      *
  19.      * @param  string  $sitePath
  20.      * @param  string  $siteName
  21.      * @param  string  $uri
  22.      * @return string|false
  23.      */
  24.     public function isStaticFile($sitePath, $siteName, $uri)
  25.     {
  26.         if (file_exists($staticFilePath = $sitePath.$uri)) {
  27.             return $staticFilePath;
  28.         }
  29.         return false;
  30.     }
  31.     /**
  32.      * Get the fully resolved path to the application's front controller.
  33.      *
  34.      * @param  string  $sitePath
  35.      * @param  string  $siteName
  36.      * @param  string  $uri
  37.      * @return string
  38.      */
  39.     public function frontControllerPath($sitePath, $siteName, $uri)
  40.     {
  41.         $_SERVER['SCRIPT_FILENAME'] = 'index.php';
  42.         $_SERVER['SCRIPT_NAME'] = '';
  43.         $_SERVER['PHP_SELF'] = '/index.php';
  44.         $_SERVER['PATH_INFO'] = $uri;
  45.         return $sitePath.'/index.php';
  46.     }
  47. }


TAG标签:
本文网址:https://www.zztuku.com/detail-9690.html
站长图库 - 聊聊valet是否有适合TP5的驱动?
申明:如有侵犯,请 联系我们 删除。

评论(0)条

您还没有登录,请 登录 后发表评论!

提示:请勿发布广告垃圾评论,否则封号处理!!

    编辑推荐

    PS绘制质感导航按钮