php - Basic routing doesn't work correctly -
I am starting Laravel and the following work is fine:
Root :: find ('User', function () {return 'user!';});
Although this does not work:
$ test = function () {Return 'User!'; } Root :: find ('user', $ test);
Why is this?
Try turning on error reporting ( error_reporting (-1);
) Therefore PHP will throw a syntax error. You have a semicolon unavailable:
$ test = function () {Return 'User!'; };
A semicolon is required because you are defining a value for a variable. If you are defining the function ( function test () {}
), then you do not need a semicolon.
Actually defined functions such as function tests () {}
, you have to set up in LARGESE. For example:
AP / controller / test controller.fp
class test controller base controller {public function index () {return ' the user!' ; }}
Apps / routes. Php
Route: Receive ('User', 'Test Controller @ Index');
Note: Composer dump-autoload
when you add a new category (i.e. TestController
) at any time > Code>) in your repository
Comments
Post a Comment