valet 有沒有適合thinkphp5的驅(qū)動?
覺得valet的思路很好所以采用了這個來做環(huán)境群凶。
公司里面用thinkphp的人比較多插爹。所以要使用thinkphp。(而且我是弄前端的请梢,后端用啥也不會特別在意)
https://github.com/curder/blog/blob/master/tools/valet_support_thinkphp.md
這是thinkphp3-valet的赠尾。
↓↓↓↓↓↓↓
自己簡單寫了一個現(xiàn)在試的可以用。
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';
}
}
本文來自PHP中文網(wǎng)毅弧,原文地址:https://www.php.cn/phpkj/thinkphp/483289.html?推薦教程:《thinkphp》