php laravel手册,学习Laravel
无详细内容 无 ?php namespace App\Http\Controllers;/** * 学习 Laravel 的测试用例 * @link http://laravel.com/docs/5.0 * @author yanming ym@mkjump.com * * @tutorial * #0, 执行 test/index方法 生成storage/app/route.txt, 添加route.txt内容到app/ht
*
* @tutorial
* #0, 执行 test/index方法 生成storage/app/route.txt, 添加route.txt内容到app/http/routes.php
* #1, 进入项目目录, 执行 php artisan route:cache (clear,list), 缓存route
*/
use DB;
use Storage;
use Illuminate\Http\Request;
class TestController extends Controller
{
const NEWLINE = "\n";
private $route = null; // 生成route的临时变量
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
}
/**
* 反射生成一个route列表
* @example
* 测试全部
* test/index
* 测试单个例子
* test/methodName
*/
public function index($methodName=Null)
{
echo "Hello, Lavavel - Self Learning!".self::NEWLINE;
echo "测试开始".self::NEWLINE;
if (!is_null($methodName) && method_exists(new self(), $methodName))
{
echo sprintf("测试 %s", $methodName).self::NEWLINE;
$this->$methodName();
}
else
{
foreach ($this->getMethod() as $k => $method)
{
echo sprintf("测试 %d - %s %s", $k, $method, self::NEWLINE);
//$this->route .= sprintf("Route::get('test/%s', 'TestController@%s')->where(['%s' => '[a-z]+']);", $method, $method, $method).self::NEWLINE;
// 调用方法
$this->$method();
}
}
// 生成route
//Storage::disk('local')->put('route.txt', $this->route);
}
/**
* 反射获取 *Test 方法
*/
private function getMethod()
{
$methods = [];
$reflector = new \ReflectionClass(new self());
foreach ($reflector->getMethods() as $methodObj)
{
if (strpos($methodObj->name, "Test") > 0) $methods[] = $methodObj->name;
}
return $methods;
}
/**
* The Basics Testing
*/
public function routeTest(){}
public function middlewareTest(){}
public function controllerTest(){}
public function requestTest(){}
public function responseTest(){}
public function viewTest(){}
/**
* Architecture Foundations Testing
*/
public function serviceProvideTest(){}
public function serviceContainerTest(){}
public function contractsTest(){}
public function facadesTest(){}
public function requestLifeCircleTest(){}
public function applicationStructureTest(){}
/**
* Service Testing
*/
public function cacheTest()
{}
public function collectionTest()
{}
public function commandBusTest(){}
public function coreExtensionTest(){}
public function elixirTest(){}
public function encryptionTest(){}
public function envoyTest(){}
public function errorTest(){}
public function logTest(){}
public function eventsTest(){}
public function filesystemTest(){}
public function hashingTest(){}
public function helpTest(){}
public function localizationTest(){}
public function mailTest(){}
public function packageTest(){}
public function paginationTest(){}
public function queueTest(){}
public function sessionTest(){}
public function templateTest(){}
public function unitTesting() {}
public function validationTest(){}
/**
* Database Testing
*/
public function basicQueryTest(){}
public function queryBuildTest(){}
public function eloquentTest(){}
public function schemaBuilderTest(){}
public function migrationTest(){}
public function seedTest(){}
public function redisTest(){}
/**
* CLI Testing
*/
public function cliTest(){echo 'cli';}
}
Route::get('test/index/{methodName?}', 'TestController@index')->where(['methodName' => '[a-z]+']);
Route::get('test/routeTest', 'TestController@routeTest')->where(['routeTest' => '[a-z]+']);
Route::get('test/middlewareTest', 'TestController@middlewareTest')->where(['middlewareTest' => '[a-z]+']);
Route::get('test/controllerTest', 'TestController@controllerTest')->where(['controllerTest' => '[a-z]+']);
Route::get('test/requestTest', 'TestController@requestTest')->where(['requestTest' => '[a-z]+']);
Route::get('test/responseTest', 'TestController@responseTest')->where(['responseTest' => '[a-z]+']);
Route::get('test/viewTest', 'TestController@viewTest')->where(['viewTest' => '[a-z]+']);
Route::get('test/serviceProvideTest', 'TestController@serviceProvideTest')->where(['serviceProvideTest' => '[a-z]+']);
Route::get('test/serviceContainerTest', 'TestController@serviceContainerTest')->where(['serviceContainerTest' => '[a-z]+']);
Route::get('test/contractsTest', 'TestController@contractsTest')->where(['contractsTest' => '[a-z]+']);
Route::get('test/facadesTest', 'TestController@facadesTest')->where(['facadesTest' => '[a-z]+']);
Route::get('test/requestLifeCircleTest', 'TestController@requestLifeCircleTest')->where(['requestLifeCircleTest' => '[a-z]+']);
Route::get('test/applicationStructureTest', 'TestController@applicationStructureTest')->where(['applicationStructureTest' => '[a-z]+']);
Route::get('test/cacheTest', 'TestController@cacheTest')->where(['cacheTest' => '[a-z]+']);
Route::get('test/collectionTest', 'TestController@collectionTest')->where(['collectionTest' => '[a-z]+']);
Route::get('test/commandBusTest', 'TestController@commandBusTest')->where(['commandBusTest' => '[a-z]+']);
Route::get('test/coreExtensionTest', 'TestController@coreExtensionTest')->where(['coreExtensionTest' => '[a-z]+']);
Route::get('test/elixirTest', 'TestController@elixirTest')->where(['elixirTest' => '[a-z]+']);
Route::get('test/encryptionTest', 'TestController@encryptionTest')->where(['encryptionTest' => '[a-z]+']);
Route::get('test/envoyTest', 'TestController@envoyTest')->where(['envoyTest' => '[a-z]+']);
Route::get('test/errorTest', 'TestController@errorTest')->where(['errorTest' => '[a-z]+']);
Route::get('test/logTest', 'TestController@logTest')->where(['logTest' => '[a-z]+']);
Route::get('test/eventsTest', 'TestController@eventsTest')->where(['eventsTest' => '[a-z]+']);
Route::get('test/filesystemTest', 'TestController@filesystemTest')->where(['filesystemTest' => '[a-z]+']);
Route::get('test/hashingTest', 'TestController@hashingTest')->where(['hashingTest' => '[a-z]+']);
Route::get('test/helpTest', 'TestController@helpTest')->where(['helpTest' => '[a-z]+']);
Route::get('test/localizationTest', 'TestController@localizationTest')->where(['localizationTest' => '[a-z]+']);
Route::get('test/mailTest', 'TestController@mailTest')->where(['mailTest' => '[a-z]+']);
Route::get('test/packageTest', 'TestController@packageTest')->where(['packageTest' => '[a-z]+']);
Route::get('test/paginationTest', 'TestController@paginationTest')->where(['paginationTest' => '[a-z]+']);
Route::get('test/queueTest', 'TestController@queueTest')->where(['queueTest' => '[a-z]+']);
Route::get('test/sessionTest', 'TestController@sessionTest')->where(['sessionTest' => '[a-z]+']);
Route::get('test/templateTest', 'TestController@templateTest')->where(['templateTest' => '[a-z]+']);
Route::get('test/unitTesting', 'TestController@unitTesting')->where(['unitTesting' => '[a-z]+']);
Route::get('test/validationTest', 'TestController@validationTest')->where(['validationTest' => '[a-z]+']);
Route::get('test/basicQueryTest', 'TestController@basicQueryTest')->where(['basicQueryTest' => '[a-z]+']);
Route::get('test/queryBuildTest', 'TestController@queryBuildTest')->where(['queryBuildTest' => '[a-z]+']);
Route::get('test/eloquentTest', 'TestController@eloquentTest')->where(['eloquentTest' => '[a-z]+']);
Route::get('test/schemaBuilderTest', 'TestController@schemaBuilderTest')->where(['schemaBuilderTest' => '[a-z]+']);
Route::get('test/migrationTest', 'TestController@migrationTest')->where(['migrationTest' => '[a-z]+']);
Route::get('test/seedTest', 'TestController@seedTest')->where(['seedTest' => '[a-z]+']);
Route::get('test/redisTest', 'TestController@redisTest')->where(['redisTest' => '[a-z]+']);
Route::get('test/cliTest', 'TestController@cliTest')->where(['cliTest' => '[a-z]+']);
本文原创发布php中文网,转载请注明出处,感谢您的尊重!
php laravel手册,学习Laravel相关推荐
- instagram架构_通过创建Instagram副本学习Laravel
instagram架构 Learn Laravel by creating an Instagram clone in this full course for beginners developed ...
- laravel database.php,php Laravel框架学习(一) 之 建立数据库并填充测试数据
php Laravel框架学习(一) php Laravel框架学习之Laravel 建立数据库并填充测试数据 建立数据库 前面我们已经明确目标网站的基本功能,现在我们先来建立它的数据库. 设计数据库 ...
- php laravel 教程,Laravel框架学习之新手教程
本篇文章主要讲述了新手学习laravel的过程中必须要了解的事项,具有一定的参考价值准备学习laravel框架的朋友一定不能错过哦,希望看完能对你有所帮助. 一.Laravel环境搭建 1.windo ...
- php laravel入口文件,Laravel学习教程之从入口到输出过程详解
php 的 Laravel学习教程之从入口到输出过程详解 本文主要给大家介绍了关于Laravel从入口到输出过程的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧. I. 预备 ...
- laravel入门学习文档
laravle总结 一丶安装1.首先安装compser.2.安装好compser后在cmd命令中输入compser出现 就安装成功了! 3.安装php的环境(自己用的是phpstudy,php环境安装 ...
- Laravel框架学习
前言: 首先,了解 Laravel 的核心概念是非常重要的.Laravel 使用了现代化的 MVC(模型-视图-控制器)架构模式,这有助于将代码逻辑分离,提高应用的可维护性和可扩展性.同时,Larav ...
- [Laravel框架学习一]:Laravel框架的安装以及 Composer的安装
1.先下载Composer-Setup.exe,下载地址:下载Composer .会自动搜索PHP.exe的安装路径,如果没有,就手动找到php路径下的php.exe. 2.在PHP目录下,打开php ...
- php laravel导入excel,Laravel 5使用Laravel Excel实现Excel/CSV文件导入导出的功能详解
@H_404_0@ 1.简介 @H_404_0@本文主要给大家介绍了关于Laravel 5用Laravel Excel实现Excel/CSV文件导入导出的相关内容,下面话不多说了,来一起看看详细的介绍 ...
- php laravel 入门教程,Laravel 5 系列入门教程(一)【最适合中国人的 Laravel 教程】...
Laravel 5 系列入门教程(一)[最适合中国人的 Laravel 教程] 2015-3-7 / 阅读数:314392 / 分类: Laravel 十分建议学习 5.5,跟 5.0 比变化非常大. ...
- 向军2017年最新laravel开发宝典 laravel结合vue与接口开发webapp实战视频教程
课程介绍: Laravel是一套简洁.优雅的PHP Web开发框架(PHP Web Framework).它不仅可以让我们从面条一样杂乱的代码中解脱出来,还可以帮我们构建一个完美的网络APP,而且每行 ...
最新文章
- 2020年AI怎么发展?听加州大学、谷歌、英伟达、IBM怎么说
- Java网页小程序——Java Applet
- java web json_java web中对json的使用详解
- ADO.NET Entity Framework建模和映射(实体框架)
- No plugin found for prefix ‘compile‘ in the current project
- matlab图像增强分段线性函数_图像增强、锐化,利用 PythonOpenCV 来实现 4 种方法!...
- 9.企业应用架构模式 --- 领域逻辑模式
- http请求转为https请求 java_如何将Javaweb工程的访问协议由http改为https及通过域名访问?...
- NodeJs或者命令行爬取网络教程并生成PDF文件,以阮一峰JavaScript教程和ES6教程为例 ...
- 【POJ 1733】Parity game【带权并查集维护奇偶】
- JVM监控及诊断工具命令行篇之jcmd
- js实现网页中元素缩放(zoom vs scale)
- Android 使用POI导出Excel表格
- 树莓派4b-centos操作系统安装包
- 【Java】面向对象(二)继承
- 蓝桥杯2013-2016真题
- 如何提高亚马逊排名?亚马逊排名规则有哪些?
- python小数乘法计算_小数乘法100道
- 递归算法_字符串反转_20230412
- Skyline WEB端开发3——添加一个弹框