Laravel创建Route
<?php
/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//直接调用视图模板
Route::get('/', function () {
return view('welcome.welcome');
});
//调用控制器中的方法
Route::get('test1','PeopelController@say');
Route::get('name','User@getName');
//直接在路由中使用某个方法
Route::get('hello',function (){
return '你好';
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
//
});
Laravel创建Route的更多相关文章
- laravel named route
laravel中一般对于路由的使用方法是在routes.php中定义一个路由,在view中如果要引用一个url则直接通过<a href="url/">来使用. 但是随着 ...
- laravel创建新model数据的两种方法
laravel中的CRUD操作中,通过对代表数据表中row的model对象操作,来更新数据库表. 对于创建新的row的操作,有两种功能上相同的方法: 1.create: $user = User::c ...
- Laravel创建Model
它已被用于CI框架.最近学习使用Laravel框架,要总结一些遇到的问题是一个创纪录,供以后调用.此外,我希望能够碰到同样的问题的朋友的帮助. 在Laravel数据库表是根据Laravel写好的程序去 ...
- laravel创建定时任务
官方文档给出的教程已经很详细了,这里给出一些补充帮助大家理解. 英文文档:https://laravel.com/docs/5.2/scheduling 中文文档:https://laravel-ch ...
- [Laravel] 02 - Route and MVC
前言 一.良心资料 英文 Laravel 框架:https://laravel.com/ 教程:https://laracasts.com/series/ laravel-from-scratch-2 ...
- Laravel创建模型
laravel中创建模型 <?php /** * Created by PhpStorm. * 新建模型 * User: chuang * Date: 17-1-15 * Time: 上午9:1 ...
- Laravel创建项目和安装PHPStorm IDE插件
一.win10下安装composer1.下载composer.phar,放入php的安装目录https://getcomposer.org/download/1.4.2/composer.phar 2 ...
- laravel 创建授权策略
用户只能编辑自己的资料 在完成对未登录用户的限制之后,接下来我们要限制的是已登录用户的操作,当 id 为 1 的用户去尝试更新 id 为 2 的用户信息时,我们应该返回一个 403 禁止访问的异常.在 ...
- Laravel 创建数据库
1.根目录输入 php artisan migrate 2.创建表 php artisan migrate:make create_authors_table --table authors --cr ...
随机推荐
- 10道典型的JavaScript面试题
问题1: 作用域(Scope) 考虑以下代码: (function() { ; })(); console.log(b); 上述代码会打印出5.这个问题的陷阱就是,在立即执行函数表达式(IIFE)中, ...
- List<实体>与List<String>数据互转
1.List<实体>数据: public List<Device> queryOSDevice(String cpu,String ip,String name){ Strin ...
- Yii2系列教程六:集成编辑器
上一篇文章我们实现了简单的用户权限管理,至于更先进的RBAC,我后面会单独出一篇文章来说说.在这一篇文章当中,我主要想写的是在Yii2中集成一个编辑器,因为在我们的实际开发当中,一个简单的textar ...
- numpy基础知识
官网简介: http://www.numpy.org/ ndarry基本属性 ndarry是Numpy中的N维数组对象(N dimentional arrya,ndarray) ndarry中所有的元 ...
- Unity学习笔记 之 关于 Unity UI 的 Slider 的代码记录
代码例如以下: using UnityEngine; using System.Collections; //1.引入 UI . using UnityEngine.UI; public class ...
- spring配置,spring中的bean 的id不能相同
lib下加入包 spring.jar commons-logging.jar src下添加 applicationContext.xml <?xml version="1.0" ...
- <转>程序员的心理疾病
注:本文转自大神王垠的博客 原文出处 http://www.yinwang.org/blog-cn/2014/02/09/programmer-mental/ 说实话,虽然似乎为之奋斗了十多年,在真正 ...
- /u200B 8203 Zero-width space 问题
[TestMethod] public void TestBom() { string str = "123";//这个字符串是错误的有问题 长度4 ).Select(x =&g ...
- 什么时候使用PHP设计模式和为什么要使用?
有大量的文章解释什么是设计模式,如何实现设计模式,网络上不需要再写一篇这样的文章.相反,在本文中我们更多的讨论什么时候用和为什么要用,而不是用哪一个和如何使用. 我将会为这些设计模式描绘不同的场景和案 ...
- 使用 %matplotlib inline 出错?
%matplotlib inline 是一个魔法函数(Magic Functions).官方给出的定义是:IPython有一组预先定义好的所谓的魔法函数(Magic Functions),你可以通过命 ...