laravel其实通过管道模式,经过三组中间件,第一组,系统自带的,设置cookie,验证一类的;第二组是路由定义的中间件,第三组就是控制器定义的中间件,以下是流程
在前面的例子中,我们引入的 monolog 版本指定为 1.0.*
。这表示任何从 1.0
开始的开发分支,它将会匹配 1.0.0
、1.0.2
或者 1.0.20
。
版本约束可以用几个不同的方法来指定。
名称 | 实例 | 描述 |
---|---|---|
确切的版本号 | 1.0.2 |
你可以指定包的确切版本。 |
范围 | >=1.0 >=1.0,<2.0 >=1.0,<1.1|>=1.2 |
通过使用比较操作符可以指定有效的版本范围。 有效的运算符: > 、>= 、< 、<= 、!= 。你可以定义多个范围,用逗号隔开,这将被视为一个逻辑AND处理。一个管道符号 | 将作为逻辑OR处理。AND 的优先级高于 OR。 |
通配符 | 1.0.* |
你可以使用通配符* 来指定一种模式。1.0.* 与>=1.0,<1.1 是等效的。 |
赋值运算符 | ~1.2 |
这对于遵循语义化版本号的项目非常有用。~1.2 相当于>=1.2,<2.0 。想要了解更多,请阅读下一小节。 |
~
最好用例子来解释: ~1.2
相当于 >=1.2,<2.0
,而 ~1.2.3
相当于 >=1.2.3,<1.3
。正如你所看到的这对于遵循 语义化版本号 的项目最有用。一个常见的用法是标记你所依赖的最低版本,像 ~1.2
(允许1.2以上的任何版本,但不包括2.0)。由于理论上直到2.0应该都没有向后兼容性问题,所以效果很好。你还会看到它的另一种用法,使用 ~
指定最低版本,但允许版本号的最后一位数字上升。
注意: 虽然
2.0-beta.1
严格地说是早于2.0
,但是,根据版本约束条件, 例如~1.2
却不会安装这个版本。就像前面所讲的~1.2
只意味着.2
部分可以改变,但是1.
部分是固定的。
一、redis
1. 存储在redis的缓存是以键值对的形式存储, 如果是数组,值是序列化后的数据
存储在redis 的键名格式 laravel_cache:(键名)
1.laravel安装完成后,访问的时候,服务器500 错误 storage 和 vendor 两个要给权限
2.
Route::get('domain/{id?}', function($account, $id=null){}
在设置了路由参数可选的时候,后面的参数一定要给默认值
3.国内用composer 安装的有好多问题,各种500错误
4. .env 配置和注释不能写在一行里面
HTTP/1.0 500 Internal Server Error
laravel 默认开启了 csrf验证
解决方案:
1.
<input type="hidden" name="_token" value="{csrf_token()}"/>
2. Kernel.php 文件里面,注释中间件:
\App\Http\Middleware\VerifyCsrfToken::class
➜ laravel git:(master) php artisan list Laravel Framework version 5.0.13 Usage: [options] command [arguments] Options(选项): --help (-h) Display this help message 显示帮助信息 --quiet (-q) Do not output any message 不输出任何消息 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 增加冗长的消息:1 正常输出 2 更加详细的输出 3调试输出 --version (-V) Display this application version 显示此应用程序的版本 --ansi Force ANSI output 强制用 ANSI码输出 --no-ansi Disable ANSI output 禁用用 ANSI码输出 --no-interaction (-n) Do not ask any interactive question 不要问任何交互式问题 --env The environment the command should run under. 在环境命令下运行 Available commands(可用的命令): clear-compiled Remove the compiled class file 清除编译后的类文件 down Put the application into maintenance mode 使应用程序进入维修模式 env Display the current framework environment 显示当前框架环境 fresh Remove the scaffolding included with the framework 清楚包含框架外的支架 help Displays help for a command 显示命令行的帮助 inspire Display an inspiring quote 显示一个启发灵感的引用 list Lists commands 列出命令 migrate Run the database migrations 运行数据库迁移 optimize Optimize the framework for better performance 为了更好的框架去优化性能 serve Serve the application on the PHP development server 在php开发服务器中服务这个应用 tinker Interact with your application 在你的应用中交互 up Bring the application out of maintenance mode 退出应用程序的维护模式 app app:name Set the application namespace 设置应用程序命名空间 auth auth:clear-resets Flush expired password reset tokens 清除过期的密码重置密钥 cache cache:clear Flush the application cache 清除应用程序缓存 cache:table Create a migration for the cache database table 创建一个缓存数据库表的迁移 config config:cache Create a cache file for faster configuration loading 创建一个加载配置的缓存文件 config:clear Remove the configuration cache file 删除配置的缓存文件 db db:seed Seed the database with records 发送数据库的详细记录 event event:generate Generate the missing events and handlers based on registration 在记录上生成错过的事件和基础程序 handler handler:command Create a new command handler class 创建一个新的命令处理程序类 handler:event Create a new event handler class 创建一个新的事件处理程序类 key key:generate Set the application key 设置程序密钥 make make:command Create a new command class 生成一个命令类 make:console Create a new Artisan command 生成一个Artisan命令 make:controller Create a new resource controller class 生成一个资源控制类 make:event Create a new event class 生成一个事件类 make:middleware Create a new middleware class 生成一个中间件 make:migration Create a new migration file 生成一个迁移文件 make:model Create a new Eloquent model class 生成一个Eloquent 模型类 make:provider Create a new service provider class 生成一个服务提供商的类 make:request Create a new form request class 生成一个表单消息类 migrate migrate:install Create the migration repository 创建一个迁移库文件 migrate:refresh Reset and re-run all migrations 复位并重新运行所有的迁移 migrate:reset Rollback all database migrations 回滚全部数据库迁移 migrate:rollback Rollback the last database migration 回滚最后一个数据库迁移 migrate:status Show a list of migrations up/down 显示列表的迁移 上/下 queue queue:failed List all of the failed queue jobs 列出全部失败的队列工作 queue:failed-table Create a migration for the failed queue jobs database table 创建一个迁移的失败的队列数据库工作表 queue:flush Flush all of the failed queue jobs 清除全部失败的队列工作 queue:forget Delete a failed queue job 删除一个失败的队列工作 queue:listen Listen to a given queue 监听一个确定的队列工作 queue:restart Restart queue worker daemons after their current job 重启现在正在运行的所有队列工作 queue:retry Retry a failed queue job 重试一个失败的队列工作 queue:subscribe Subscribe a URL to an Iron.io push queue 去Iron.io 订阅URL,放到队列上 queue:table Create a migration for the queue jobs database table 创建一个迁移的队列数据库工作表 queue:work Process the next job on a queue 进行下一个队列任务 route route:cache Create a route cache file for faster route registration 为了更快的路由登记,创建一个路由缓存文件 route:clear Remove the route cache file 清除路由缓存文件 route:list List all registered routes 列出全部的注册路由 schedule schedule:run Run the scheduled commands 运行预定命令 session session:table Create a migration for the session database table 创建一个迁移的SESSION数据库工作表 vendor vendor:publish Publish any publishable assets from vendor packages 发表一些可以发布的有用的资源来自提供商的插件包
一、mysql数据库处理 select * from activity_channel order by convert(channel_name using gbk);
二、php处理
function cmp($a, $b) { $a["fruit"] = iconv("UTF-8", "gb2312", $a["fruit"]); $b["fruit"] = iconv("UTF-8", "gb2312", $b["fruit"]); return strcmp($a["fruit"], $b["fruit"]); } $fruits[0]["fruit"] = "比较"; $fruits[1]["fruit"] = "阿拉丁"; $fruits[2]["fruit"] = "阿猫"; print_r($fruits); usort($fruits, "cmp"); while (list($key, $value) = each($fruits)) { echo "$fruits[$key]: " . $value["fruit"] . "\n"; }
编辑php-fpm.conf,把pid文件注释去掉,这里加了注释并不是默认值,而是不生成pid文件。
启动,php-fpm
关闭:kill -INT `cat /home/server/php-5.4.15/var/run/php-fpm.pid`
重启:kill -USR2 `cat /home/server/php-5.4.15/var/run/php-fpm.pid`
php-version是一个帮助管理从brew安装的php版本切换的工具。
安装简单
$brew install php-version
然后执行
$source $(brew --prefix php-version)/php-version.sh && php-version 5
直接执行
php-version
就可以看到现有的版本,比如我自己的
$ php-version
* 5.6.4
5.6.5
然后使用以下命令切换即可
$php-version 5.6.5
再看php的版本,已经切换好了。
这我我之前遇到的问题,解决方式
1.升级homebrew版本
2.xcode-
select
--
install