抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

启动流程

xss 编辑跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS。恶意攻击者往Web页面里插入恶意Script代码,当用户浏览该页之时,嵌入其中Web里面的Script代码会被执行,从而达到恶意攻击用户的特殊目的 主要防范:过滤客户提交内容,不能信任客户提交内容.目前来看...

###参考 artisan make:model 而写的 make:view 新建blade模版

  • MakeView.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    <?php

    namespace App\Console\Commands;

    use Illuminate\Console\Command;
    use Illuminate\Filesystem\Filesystem;

    class MakeView extends Command
    {
    /**
    * The name and signature of the console command.
    *
    * @var string
    */
    protected $signature = 'make:view {name : like content or article/content}';

    /**
    * The console command description.
    *
    * @var string
    */
    protected $description = 'Create a new blade page';

    /**
    * The type of class being generated.
    *
    * @var string
    */
    protected $type;

    /**
    * 文件系统
    * @var Filesystem
    */
    protected $files;
    /**
    * Create a new command instance.
    *
    * @return void
    */
    public function __construct(Filesystem $files)
    {
    parent::__construct();

    $this->files=$files;
    }

    /**
    * Execute the console command.
    *
    * @return mixed
    */
    public function handle()
    {
    //
    $path = $this->getPath($this->argument('name'));

    if($this->alreadyExists($path)){
    $this->error($this->type.' already exists!');
    return false;
    }

    $this->makeDir($path);

    $this->files->put($path, $this->getStub());

    return $this->info($this->type.' created successfully.');
    }

    /**
    * Get path
    * @param string $name
    * @return string
    */
    protected function getPath($name){
    return base_path('resources/views')."/".$name.".blade.php";
    }

    /**
    * 模版是否已经存在
    * @param $path
    * @return bool
    */
    protected function alreadyExists($path){
    return $this->files->exists($path);
    }

    /**
    * 建立目录
    * @param $path
    */
    protected function makeDir($path){
    if (! $this->files->isDirectory(dirname($path))) {
    $this->files->makeDirectory(dirname($path), 0777, true, true);
    }
    }

    /**
    * 获得模版内容
    * @param string $stub //现在默认为bootstrap风格 以后还可以添加妹子UI风格模版等等
    * @return string
    * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
    */
    protected function getStub($stub='view.stub'){
    return $this->files->get(__DIR__.'/stubs/'.$stub);
    }
    }

  • ContactServiceProvider 服务提供者

    这里面 registerContact() 其实是没用的 应该是调用其他服务功能时才有用.
    但是这个简单功能完全可通过router和controller完全能实现所以 感觉不需要写个什么服务了.
    暂时这么理解吧

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php namespace Jai\Contact;

use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;

class ContactServiceProvider extends ServiceProvider
{
protected $defer = false;
public function boot()
{
//注册模版地址 这里一定要使用realpath() 不是绝对路径就会出错
$this->loadViewsFrom(realpath(__DIR__.'/../views'), 'contact');
//注册包路由
$this->setupRoutes($this->app->router);
// this for conig
$this->publishes([
__DIR__.'/config/contact.php' => config_path('contact.php'),
]);
}

/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function setupRoutes(Router $router)
{
//设置路由命名空间
$router->group(['namespace' => 'Jai\Contact\Http\Controllers'], function($router)
{
require __DIR__.'/Http/routes.php';
});
}

public function register()
{
$this->registerContact();
config([
'config/contact.php',
]);

//这两句是从stripe里摘出来的 绑定名称 以后注入用
$this->app->singleton('command.cashier.table', function ($app) {
return new CashierTableCommand;
});
//这里相当于注册一个command命令 参数:这里就用到上边的绑定注入了
$this->commands('command.cashier.table');
}

private function registerContact()
{
$this->app->bind('contact',function($app){
//这个绑定毫无意义 也许可能是没有用到
//return new Contact($app);
return new elick($app);
});
}
}

详细内容 请参考这篇文章Bower的简单使用教程 bower init 生成 bower.json 这个是项目安装的组件包bower --save XXX 这是本项目安装组件 并记录在bower.json bowerrc文件简单说明 directory:是值第三方依赖包下载所在的位置proxy:在很多公司,为了保护公司内网的安全性,是需要配置这个代理的。所以这里一般要配置公司的代理ti...