Home > Article > PHP Framework > Let's talk about whether valet has a driver suitable for TP5?
The following thinkphp framework tutorial column will introduce to you the issue of whether valet has a driver suitable for thinkphp5. I hope it will be helpful to friends in need!
valet Is there a driver suitable for thinkphp5?
I think valet’s idea is very good, so I adopted this as the environment.
There are many people using thinkphp in the company. So use thinkphp. (And I am working on the front end, so I don’t particularly care what I use for the back end)
https://github.com/curder/blog/blob/master/tools/valet_support_thinkphp.md
This is thinkphp3-valet.
↓↓↓↓↓↓↓
I simply wrote one that I can try now.
<?php class ThinkPHP5ValetDriver extends ValetDriver { /** * Determine if the driver serves the request. * * @param string $sitePath * @param string $siteName * @param string $uri * @return bool */ public function serves($sitePath, $siteName, $uri) { return true; } /** * Determine if the incoming request is for a static file. * * @param string $sitePath * @param string $siteName * @param string $uri * @return string|false */ public function isStaticFile($sitePath, $siteName, $uri) { if (file_exists($staticFilePath = $sitePath.$uri)) { return $staticFilePath; } return false; } /** * Get the fully resolved path to the application's front controller. * * @param string $sitePath * @param string $siteName * @param string $uri * @return string */ public function frontControllerPath($sitePath, $siteName, $uri) { $_SERVER['SCRIPT_FILENAME'] = 'index.php'; $_SERVER['SCRIPT_NAME'] = ''; $_SERVER['PHP_SELF'] = '/index.php'; $_SERVER['PATH_INFO'] = $uri; return $sitePath.'/index.php'; } }
Recommended: "The latest 10 thinkphp video tutorials"
The above is the detailed content of Let's talk about whether valet has a driver suitable for TP5?. For more information, please follow other related articles on the PHP Chinese website!