valet有適合TP5的驅(qū)動?

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容