slim-3

    2熱度

    3回答

    使用Slim對我的控制器進行分組,並且通常爲每個組擴展一個抽象的BaseController。我使用基於類的路由: /* SLIM 2.0 */ // Users API - extends BaseApiController $app->post('/users/insert/' , 'Controller\Api\UserApiController:insert'); . . //

    3熱度

    1回答

    我們正在尋找使用Slim 3作爲我們API的框架。我搜索了SO和Slim文檔,但無法找到問題的答案。如果我們有不同的路由文件(例如v1,v2等),並且兩個路由具有相同的簽名,則會引發錯誤。是否有任何方法級聯路由,以便使用特定簽名的最後加載路由? 例如,說v1.php有一個路線GET ("/test")和v2.php也包含這條路線,我們可以使用最新版本嗎?更簡單的是,如果一個路由文件包含兩個具有相同

    0熱度

    1回答

    在這種情況下,如何獲取參數? $this->get('/{id}', function($request, $response, $args) { return $response->withJson($this->get('singleSelect')); }); $this->appContainer['singleSelect'] = function ($id) {

    0熱度

    1回答

    我正在升級到slim v3。我應該如何使用數據庫連接?我在想有疙瘩注射服務: DBConnection的 final class DBConnection { private $db; public function __construct() { try { // Code to open up a DB connection in $db va

    0熱度

    1回答

    我試圖通過swiftmailer和gmail在本地發送一個聯繫表單的郵件。我檢查了每一行,我知道問題是'setFrom'。 $app->post('/contact', function ($request, $response, $args){ $body = $this->request->getParsedBody(); $name = $body['name']; $email =

    7熱度

    3回答

    修身3之前被釋放,下面做工精細代碼: 的settings.php, return [ 'settings' => [ 'displayErrorDetails' => true, 'modules' => [ 'core' => 'config/core/modules.php', 'local' => 'config/local/mo

    2熱度

    1回答

    什麼是HTTP緩存?我如何在Slim 3中使用它? 但我不太清楚如何this is done in Slim 3: use Slim\Http\Request; use Slim\Http\Response; require_once __DIR__ . '/../vendor/autoload.php'; // Register service provider with the co

    1熱度

    2回答

    我知道如何創建一個緩存頁面純PHP,例如, // @ref: http://wesbos.com/simple-php-page-caching-technique/ // // define the path and name of cached file $cachefile = 'cache/'.date('M-d-Y').'.php'; // define how long we

    0熱度

    1回答

    我遇到了這個slim3 php代碼的問題。在函數createErrorReponse函數中,$ response-> getBody()爲空或空。 Php抱怨下面的錯誤。正如你所看到的那樣,getBody()的大小是空的,因此編寫不起作用。儘管如此,其他功能也適用同一條線。 HTTP/1.1 200 OK Content-Type:text/html;字符集= UTF-8 0 致命錯誤:調用一個成

    1熱度

    3回答

    因此,我最近決定將我的Slim2應用程序轉換爲較新的第三版本,很多應用程序必須更改等。 另一件事是閃存消息從核心框架中刪除,所以我決定去作曲家添加他們,我意識到他們也改變了太多,出於某種原因,我得到了一個具有兩個值的數組而不是一個。 $container['flash'] = function ($c) { return new \Slim\Flash\Messages(); };