E
E
EVOSandru62017-05-21 22:13:46
Yii
EVOSandru6, 2017-05-21 22:13:46

Why is YII2 not reading the GET parameter in an action of a certain name?

Good afternoon,
There is such a problem. Despite the fact that everything works adequately on the locale, on the hosting the address looks like:
hostname.com/driver/transports/set-image?id={id}
For the action:

...
use yii\web\Controller;
class BasicController extends Controller {
...
     public function actionSetImage($id)
    {
        echo $id;
        die();
    }
...
}

Throws:
Missing argument 1 for app\components\BasicController::actionSetImage(), called in /var/www/vhosts/hostname.com/httpdocs/modules/driver/controllers/TransportsController.php on line 22 and defined
Root .htaccess :
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule (.*) web/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php

web/.htaccess :
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

urlManager :
'urlManager' => [
            'class' => 'yii\web\UrlManager',
            'showScriptName' => false,
            'enablePrettyUrl' => true,
            'rules' => [
                 'login' => 'auth/login',
                 'signup' => 'auth/signup',
                 'profile' => 'users/profile',
            ],
        ],

It seems like everything is standard. A Yii2 variant of the basic type .
If, for example, I change the name of the actionSetImage to actionSetImag , and the url to:
hostname.com/driver/transports/set-imag?id={id}
then I normally get the ID even on hosting.
What could be the snag?
The problem is that I can’t formulate a question for the support service, it’s strange that everything works on the local (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-05-22
@EVOSandru6

At you an error in TransportsControlleron line 22, and you result a code BasicController
Apparently at you it is caused from TransportsControllera method and the obligatory argument is not transferred.
You have an error both on the server and on the LAN, it's just that the errors are apparently disabled on the LAN.
PS. You have a strange architecture there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question