Home >Backend Development >PHP Tutorial >laravel5 routing configuration tips

laravel5 routing configuration tips

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:11:58992browse

It is too cumbersome to generate a route for each method of the controller,
Method 1,

<code>Route<span>::controller(<span>'demos'</span>, <span>'Demo2Controller'</span>);</span></code>
<code><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

<span><span>class</span><span>Demo2Controller</span><span>extends</span><span>Controller</span></span>
{
    <span>/**
     * Responds to requests to GET /users
     */</span>
    public function getIndex()
    {
        <span>//</span><span>return</span><span>1</span>;
    }

    <span>/**
     * Responds to requests to GET /users/show/1
     */</span>
    public function getShow($id)
    {
        <span>//</span><span>return</span> $id;
    }

    <span>/**
     * Responds to requests to GET /users/admin-profile
     */</span>
    public function getAdminProfile()
    {
        <span>//</span>
    }

    <span>/**
     * Responds to requests to POST /users/profile
     */</span>
    public function postProfile()
    {
        <span>//</span>
    }
}
</code>

laravel5 路由配置 技巧
Visit http://localhost:8000/demos/index

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces laravel5 routing configuration skills, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn