vagrant box add laravel/homestead ./virtualbox.box
cp .env.example .env
D:\xampp\apache\conf\extra\httpd-vhosts.conf
NameVirtualHost *:80
##ServerAdmin [email protected]
DocumentRoot "D:/work_php/service/public/"
ServerName www.a.com
Require all granted
chrome://net-internals/#dns
和chrome://net-internals/#sockets
#Google Chrome virtual hosts not working with ERR_NAME_NOT_RESOLVED error after update http://www.cnblogs.com/hustskyking/p/hosts-modify.htmlupdate user set password=password('123456') where User='root'
修改phpmyadmin下的config.inc.php
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['password'] = ' '
, $cfg['Servers'][$i]['password'] = '123456'
; {xampp_dir}/apache/conf/httpd.conf
#LoadModule rewrite_module modules/mod_rewrite.so
前面的井号安装,推荐通过 Laravel 安装工具安装 Laravel
composer global require "laravel/installer"
laravel new yourapp
或者composer create-project laravel/laravel yourapp
quickstart 中文
git clone https://github.com/laravel/quickstart-basic quickstart
cd quickstart
composer install
php artisan migrate
创建完成之后进入到blog目录,修改app/config/app.php中的timezone为PRC、locale为zh
composer dump-autoload
#FatalErrorException报这个错就执行Demo auth auth2
// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');
Route::controllers([
'password' => 'Auth\PasswordController',
]);
demo
php artisan make:migration create_mydatas_table --create=mydatas
#创建一个“数据库迁移(migration)”,其对应一张数据库表mydatas
#迁移文件会被放在项目下的 database/migrations 文件夹中
increments('id');
$table->string('name');#你手动添加的一个字段
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mydatas');
}
}
php artisan migrate
#执行数据迁移,会在数据库中add mydatas这张表php artisan make:model MyData
php artisan make:model --migration MyData
或php artisan make:model -m MyData
#上面make:migration和make:model可以用这一句代替php artisan make:migration add_content_to_tasks_table --table=tasks
#增加一列php artisan make:controller TaskController
#\app\Http\routes.php
/**
* Show Task Dashboard
*/
Route::get('/','TaskController@index');
/**
* Show Task Dashboard
*/
Route::get('/task/{id}', 'TaskController@show');
/**
* Add New Task
*/
Route::post('/task', 'TaskController@store');
/**
* Delete Task
*/
Route::delete('/task/{id}', 'TaskController@destroy');
#\app\Http\Controllers\TaskController.php
Task::orderBy('created_at', 'asc')->get()
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
]);
if ($validator->fails()) {
return redirect('/')
->withInput()
->withErrors($validator);
}
$task = new Task;
$task->name = $request->name;
$task->save();
return redirect('/');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$task = Task::findOrNew($id);
print $task;
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
Task::findOrFail($id)->delete();
return redirect('/');
}
}
laravelcollective/html
参考
"require": {
"laravelcollective/html": "5.1.*"
}
composer update
config/app.php
:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
]
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
发布到阿里云ECS(我用的oninstack)
配置vhost,必须有如下字段:
server {
server_name task.xxxx.com;
index index.php index.html index.htm;
root /data/wwwroot/task.xxxx.com/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
解析你相应的网址task.xxxx.com
,这个时候,主页面应该可以访问了。
chown -R www:www task.xxxx.com
chmod -R 775 ./task.xxxx.com/quickstart-intermediate/storage
artisan、artisan
自学成才
php artisan list
php artisan help migrate
下载文件报错
uncomment this line in php.ini into php folder. extension=php_fileinfo.dll
其它
理解OAuth 2.0