小编mos*_*toh的帖子

如何选择具有表名:“组”的表?

我有一张桌子。表的名称是“组”

我运行这样的查询:

SELECT * FROM GROUP
Run Code Online (Sandbox Code Playgroud)

存在这样的错误:

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group 
 LIMIT 0, 1000' at line 1
Run Code Online (Sandbox Code Playgroud)

有什么解决方案可以解决我的问题?

谢谢

mysql

7
推荐指数
1
解决办法
4050
查看次数

从ajax请求下载laravel pdf文件(laravel 5)

我的html代码是这样的:

<a href="javascript:;" onclick="showAjaxPdf('{{ $row->file_path }}');"><i class="fa fa-file-pdf-o"></i></a>
Run Code Online (Sandbox Code Playgroud)

我的JavaScript代码是这样的:

function showAjaxPdf(file_path)
        {
            var file_path = file_path.replace(/\\/g,"/");
            //example : file_path = assets/images/myfile.pdf
            $.ajax({
                type: "POST",
                data: 'file_path=' + file_path,
                url: "news/test",
                success: function(response)
                {
                    $('#test').html(response);

                }
            });
        }
Run Code Online (Sandbox Code Playgroud)

我在控制器中的功能测试:

public function postTest(Request $request)
    {
$file_path = $request->input('file_path');  
        return response()->download($file_path);       
    }
Run Code Online (Sandbox Code Playgroud)

当我单击pdf图标时,没有响应。

我希望当单击pdf图标时显示如下:

在此处输入图片说明

单击pdf图标时,图像如何显示?

谢谢

javascript pdf ajax download laravel

6
推荐指数
1
解决办法
1万
查看次数

如何解决"TypeError:$(...).长度不是函数"?

我的代码是这样的:

$(document).ready(function () {
    size_li = $("#myList li").length();
    x=3;
    $('#myList li:lt('+x+')').show();
    $('#loadMore').click(function () {
        x= (x+5 <= size_li) ? x+5 : size_li;
        $('#myList li:lt('+x+')').show();
    });
    $('#showLess').click(function () {
        x=(x-5<0) ? 3 : x-5;
        $('#myList li').not(':lt('+x+')').hide();
    });
});
Run Code Online (Sandbox Code Playgroud)

或者在这里查看演示和完整代码:http://jsfiddle.net/oscar11/6FzSb/4177/

我使用jquery 3.0.1

执行时,存在错误:

TypeError:$(...).length不是函数

我该如何解决?

javascript jquery

6
推荐指数
1
解决办法
2万
查看次数

如何在laravel 5中显示最后一个查询?

我用 :

DB::connection()->enableQueryLog();
var_dump(DB::getQueryLog());
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

我的服务是这样的:

public function dataCustomerList($param) 
    {
        $status = $param['status_sort'];
        $gender = $param['gender'];
        $published = $param['published'];

        if($published=='NO'){
            $published_check = 'NO';
            $published = 0;
        }
        else if($published=='YES'){
            $published_check = 'YES';
            $published = 1;
        }
 DB::connection()->enableQueryLog();
        $customer = customer::paginate(10);

        if(!empty($status)) {
            // die($status);
            $customer = customer::where('tb_customer.customer_status', '=', $status)->paginate(10);
        }

        if (!empty($gender)) {
            $customer = customer::where('tb_customer.gender', '=', $gender)->paginate(10);
        }

        if (!empty($published_check)) {
            $customer = customer::where('tb_customer.published', '=', $published)->paginate(10);
        }
        var_dump(DB::getQueryLog());
        return $customer;


    }   
Run Code Online (Sandbox Code Playgroud)

当我运行它时,查询不会出现

结果是这样的:

array(0) {
}
Run Code Online (Sandbox Code Playgroud)

如何在Laravel 5中执行查询?

非常感谢你

laravel laravel-5

5
推荐指数
0
解决办法
1604
查看次数

如何调整Bootstrap DatePicker的大小?

我的代码是这样的:

HTML:

<div class="input-append date datepicker no-padding" data-date-format="dd-mm-yyyy">
    <input class="input-medium" size="16" type="text"><span class="add-on"><i class="icon-th"></i></span>
</div>
Run Code Online (Sandbox Code Playgroud)

Javascript:

$(document).ready(function() {
    $('.datepicker').datepicker({
        autoclose: true,
        startDate: new Date()
    });
});
Run Code Online (Sandbox Code Playgroud)

演示:jsfiddle

我想改变bootstrap datepicker的大小

任何解决我的问题的建议

谢谢

css jquery datepicker twitter-bootstrap

5
推荐指数
1
解决办法
3万
查看次数

如何在 CodeIgniter 中实现 Redis?

我得到了教程:

http://yaminnoor.com/redis-codeigniter/

https://codeigniter.com/user_guide/libraries/caching.html#redis

我像这样尝试:

配置 ( application\config\redis.php):

defined('BASEPATH') OR exit('No direct script access allowed');

$config['socket_type'] = 'tcp'; //`tcp` or `unix`
$config['socket'] = '/var/run/redis.sock'; // in case of `unix` socket type
$config['host'] = '127.0.0.1'; //change this to match your amazon redis cluster node endpoint
$config['password'] = NULL;
$config['port'] = 6379;
$config['timeout'] = 0;
Run Code Online (Sandbox Code Playgroud)

控制器:

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Redis_tes extends CI_Controller {
    public function __construct() {
        parent::__construct();

        $this->load->driver('cache', array('adapter' => 'redis', 'backup' => …
Run Code Online (Sandbox Code Playgroud)

php codeigniter redis

5
推荐指数
1
解决办法
2万
查看次数

单击模态中的图像后如何显示图像?

我的HTML代码是这样的:

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                 <h4 class="modal-title" id="myModalLabel">Modal title</h4>

            </div>
            <div class="modal-body">


            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
Run Code Online (Sandbox Code Playgroud)

我的Javascript代码是这样的:

<script type="text/javascript">

    htmlData = '';
    htmlData = 'Photos<a href="#" id="hotel_photo" data-hotel-code="nases">(Click to View)</a><br><br>';
    htmlData += …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery twitter-bootstrap

5
推荐指数
1
解决办法
922
查看次数

如何在 vue.js 2 上获得 this.$store.dispatch 的响应?

我的组件是这样的:

<script>
    export default{
        props:['search','category','shop'],
        ...

        methods: {
            getVueItems: function(page) {
                this.$store.dispatch('getProducts', {q:this.search, cat:this.category, shop: this.shop, page:page}).then(response => {
                    console.log(response)
                    this.$set(this, 'items', response.body.data)
                    this.$set(this, 'pagination', response.body)
                }, error => {
                    console.error("this is error")
                })
            },
            ...
        }
    }
</script>
Run Code Online (Sandbox Code Playgroud)

ajax 调用 product.js 模块上的 getProducts 方法

product.js 模块是这样的:

import { set } from 'vue'
import product from '../../api/product'
import * as types from '../mutation-types'

// initial state
const state = {
    list: {}
}

// actions
const actions = {
    getProducts …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component laravel-5.3 vuejs2

5
推荐指数
1
解决办法
7592
查看次数

我如何加入Eloquent:关系?

我的查询是这样的:

<?php
public function getListReviews()
{
    $reviews = Review::where('user_id', auth()->user()->id)
                     ->get();
    return $reviews;
}
Run Code Online (Sandbox Code Playgroud)

从查询中,它可以按ID获取所有评论数据

我想要获取用户照片,商店照片和产品照片

我想用口才:关系

我如何通过口才:关系?

我的审查模式是这样的:

<?php
namespace App;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\HybridRelations;
class Review extends Eloquent
{
    use HybridRelations;
    protected $connection = 'mongodb';
    protected $fillable = ['user_id', 'user_name', 'product_id', 'product_name', 'store_id', 'store_name', 'invoice_number', 'rating', 'comments', 'created_at', 'updated_at'];
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的用户模型是这样的:

<?php
namespace App;
...
class User extends Authenticatable
{
    ...
    protected $fillable = ['name', 'email', 'password', 'birth_date', 'mobile_number', …
Run Code Online (Sandbox Code Playgroud)

php relationships laravel eloquent laravel-5.3

5
推荐指数
1
解决办法
8446
查看次数

在 vue 组件上循环完成后如何调用语句或方法?

我的 vue 组件是这样的:

<template>
    <div class="row">
        <div class="col-md-3" v-for="item in items">
            ...
        </div>
    </div>
</template>
<script>
    export default {
        ...
        computed: {
            items() {
                ...
            }
        },
        ...
    }
</script>
Run Code Online (Sandbox Code Playgroud)

如果循环完成,我想调用一个语句或方法

所以当循环完成时执行该语句

我该怎么做?

更新 :

从 Kira San 的回答中,我尝试这样:

  <template>
        <div class="row">
            <div class="col-md-3" v-for="(item, key) in items" v-for-callback="{key: key, array: items, callback: callback}">
                ...
            </div>
        </div>
    </template>
    <script>
        export default {
            ...
            computed: {
                items() {
                    const n = ...
                    return n
                }
            },
            directives: {
              forCallback(el, binding) { …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-component vuejs2

5
推荐指数
1
解决办法
4240
查看次数