随笔分类 -  laravel

摘要:1.前后端不分离 (form表单提交) 控制器定义验证规则 <?php namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; class 阅读全文
posted @ 2020-07-13 12:17 钧一 阅读(1024) 评论(0) 推荐(0)
摘要:前端输出session {{ Session::get('username') }} ajax提交 控制器层 阅读全文
posted @ 2019-05-14 15:42 钧一 阅读(1349) 评论(0) 推荐(0)
摘要:在resources/views里创建layouts,并在layouts里创建app.blade.php, 这个php文件放的就是你的页面框架,也就是多页面公用的内容,如下 在resources/views里面创建一个index.blade.php,控制器渲染此页面,页面内容如下 阅读全文
posted @ 2019-04-12 15:29 钧一 阅读(563) 评论(0) 推荐(0)
摘要:在config目录创建一个 bl.php ,内容如下 打开cmd进入进入到laravel项目里 执行命令 打开bootstrap/cache/config.php,搜索bl ,你会看到 'bl' => array ( 'IND' => "1321232",'das' => "奥术大师多" ), 如果 阅读全文
posted @ 2019-04-10 11:03 钧一 阅读(2267) 评论(0) 推荐(0)
摘要:找到 config/database.php 找到.env,修改里面的配置 阅读全文
posted @ 2019-03-18 17:21 钧一 阅读(5850) 评论(0) 推荐(0)
摘要:引入css 默认引入public目录 引入js 默认引入public目录 引入外面的的css 把http:去掉即可 引入外面的的js 把http:去掉即可 阅读全文
posted @ 2019-03-18 16:05 钧一 阅读(1784) 评论(0) 推荐(0)
摘要:V层 即视图层 也就是常用的html页面 但在laravel里后缀为php 视图层路径resources/views/视图名称.php 阅读全文
posted @ 2019-03-18 11:58 钧一 阅读(271) 评论(0) 推荐(0)
摘要:视图层 route 中文 路由 <a href="{{route('cc',array('id'=>11111))}}">446454</a> 路由层 Route::get('当前路径','控制器@方法')->name('cc'); 控制器 use Illuminate\Http\Request;/ 阅读全文
posted @ 2019-01-24 17:30 钧一 阅读(3047) 评论(0) 推荐(0)
摘要:Laravel 框架使用 Composer 来管理其依赖性。所以,在你使用 Laravel 之前,你必须在你电脑上是否安装了 Composer。最简单的获取Composer的方式就是百度之,百度关键字“composer-setup.exe”即可。 注:安装Composer前要先确定电脑里有没有配置p 阅读全文
posted @ 2019-01-24 15:10 钧一 阅读(238) 评论(0) 推荐(0)
摘要:POST方式接收 视图层 <form action="/submit" method="post"> {{csrf_field()}} //必加 <input type="text" name="a"></input> <input type="text" name="b"></input> <in 阅读全文
posted @ 2019-01-24 11:53 钧一 阅读(751) 评论(0) 推荐(0)
摘要:翻译过来就是 期望参数1是字符串 意思就是说变量为数组,应以数组的方式输出 @foreach($xxx as $k=>$y) {{$k}}{{$y}} @endforeach 阅读全文
posted @ 2019-01-17 17:47 钧一 阅读(8085) 评论(0) 推荐(0)
摘要:@foreach($xxx as $k=>$y) {{$y->id}} @endforeach 阅读全文
posted @ 2019-01-17 17:10 钧一 阅读(1770) 评论(0) 推荐(0)
摘要:DB::table('表名')->get(); //查询表里的所有数据 DB::table('表名')->where()->find(需要查询的条数); 查询单或多条数据 DB::table('表名')->insert(要添加的数据); 在表里添加一条数据 DB::table('表名')->wher 阅读全文
posted @ 2019-01-17 15:03 钧一 阅读(1295) 评论(0) 推荐(0)
摘要:<?php namespace App\Http\Controllers; use App\Index; use App\Http\Controllers\Controller; class IndexController extends Controller{ public function in 阅读全文
posted @ 2019-01-17 09:55 钧一 阅读(300) 评论(0) 推荐(0)
摘要:目录 App\Models 没有就自己创一个 创建对应控制器的php文件,首字母大写 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; clas 阅读全文
posted @ 2019-01-17 09:37 钧一 阅读(357) 评论(0) 推荐(0)
摘要:目录 routes\web.php 初始路由,直接渲染视图welcome,即V层 '/'为路径:www.xxx.com/ Route::get('/', function () { return view('welcome'); }); 直接渲染视图welcome,即V层 'home'为路径:www 阅读全文
posted @ 2019-01-17 09:00 钧一 阅读(1391) 评论(0) 推荐(0)
摘要:目录 app\config\app.php 找到 'timezone' =>'',在双引号里加上PRC(中华人民共和国缩写)即可; 阅读全文
posted @ 2019-01-16 16:56 钧一 阅读(3201) 评论(0) 推荐(0)
摘要:laravel MVC分布 M app\Http\Middleware V resources\views C app\Http\Controllers 数据库配置 目录 config\database.php 根据自己所需要的选取并修改ip地址,以及在第16行的default里设置自己需要的数据库 阅读全文
posted @ 2019-01-16 16:40 钧一 阅读(377) 评论(0) 推荐(0)