[英]how do I get the attributes of “fk_login_cidadao” with php and slim-framework?
[英]How to check the url in the controller slim-framework
我slim
有問題
我有控制者,並且有2條潰敗發送給該控制器。
現在,我需要檢查是否需要以下網址: /product/{slug}
退回樹枝(我退貨)。
如果我請求url: api/product/{slug}
我返回json(我會返回)。
現在,我不知道如何處理if要求。 以及我如何知道檢查哪個URL請求該控制器。
$request->getUri()->getPath()
將為您提供當前URL。
$request->getAttribute('route')
將給您當前的Route
對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.