0
ZF3を使用してURLからパラメータを取得しようとして問題が発生しました。私はURLから任意の値を渡すしようとすると、私は常にデフォルト値を持っている:http://domain/game/1ZF3:URLからパラメータを受信しない
module.config.php
'game' => [
'type' => Segment::class,
'options' => [
'route' => '/game[/:id]',
'constraints' => [
'id' => '[0-9]*',
],
'defaults' => [
'controller' => Controller\GameController::class,
'action' => 'index',
],
],
],
GameController.php
私は何class GameController extends BaseController
{
public function indexAction()
{
$log = new LogWriter();
$id = $this->params()->fromQuery('id', 'null');
$log->writeLog(get_class($this) . "::" . __FUNCTION__ . " id partido: " . $id);
return [];
}
}
間違っている?
はそんなにティム・ファウンテンをありがとう!できます!!! –