小编Chr*_*oni的帖子

Laravel + Vagrant =用户'root'@'localhost'拒绝访问

我已经看到stackoverflow上的许多用户都有类似的问题,但是根据答案,我无法使其工作.

当我跑:

php artisan migrate
Run Code Online (Sandbox Code Playgroud)

我明白了:

[PDOException]                                                                         
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) 
Run Code Online (Sandbox Code Playgroud)

这是我的app/config/app.php

'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'mio_sito',
            'username'  => 'root',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),
Run Code Online (Sandbox Code Playgroud)

问题是我实际上没有密码,如果我登录到vagrant:

vagrant ssh
Run Code Online (Sandbox Code Playgroud)

我可以访问mysql:

mysql -u root
Run Code Online (Sandbox Code Playgroud)

并且不需要密码.
我该如何解决这个问题?

mysql vagrant

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

Ionic-BarcodeScanner .scan不是功能

我正在使用ionic 4.0.6构建的新应用程序中实现QRCode扫描仪,并且遵循了有关如何集成扫描仪的文档。

这里的文档:https : //ionicframework.com/docs/native/barcode-scanner/

离子信息:

Ionic:

   ionic (Ionic CLI)  : 4.0.6 (/Users/christiangiupponi/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 7.0.1
   Cordova Platforms     : android 6.2.3

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.4
   NodeJS            : v10.8.0 (/usr/local/bin/node)
   npm               : 5.0.3
   OS                : macOS High Sierra
   Xcode             : Xcode 10.1 Build version 10B61

Environment:

   ANDROID_HOME : /Users/christiangiupponi/Library/Android/sdk
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

app.modules.ts

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core'; …
Run Code Online (Sandbox Code Playgroud)

ionic-framework

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

Laravel eloquent - 合并父 $appends

假设我有两个模型,Veichle并且Car

Veichle extends Model {
    $appends = ['append_1', 'append_2'];
}
Run Code Online (Sandbox Code Playgroud)

Car extends Veichle {
    $appends = ['append_3', 'append_4'];
}
Run Code Online (Sandbox Code Playgroud)

append_1如果我有 Car 对象,我该如何使用?这样Car类只是重写了父类$appends,我没有找到任何方法来合并它

laravel eloquent

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

Laravel-路由和语言代码

我需要在网址中添加语言代码,但当它是默认代码时则不需要。

这是routes.php文件中的代码Laravel 4.2

我需要像这样的根结构:

默认语言=> http://website.com/RegistrationStep1
其他语言=> http://website.com/language/RegistrationStep1

Route::group(['prefix' => '{lang?}', 'before' => 'localization'], function()
{

    Route::get('/', function() {
        return View::make('hello');
    });

    Route::get('registration/step1', 'RegistrationController@getRegistrationStep1');

    Route::post('registration/step1', 'RegistrationController@postRegistrationStep1');
});
Run Code Online (Sandbox Code Playgroud)

在没有url语言参数的情况下调用url时出现错误

laravel-4

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

Flutter - TextField如何过滤列表

我是 Flutter 的新手,我正在尝试了解它是如何工作的。
我创建了一个简单的应用程序,应该显示商店列表,我需要整个屏幕滚动,据我所知,我无法使用ListView.

我还添加了一个TextField,我想用它来过滤内容,以便用户可以看到他想要的商店。

这是我的代码:

import 'package:testapp/models/maison.dart';
import 'package:testapp/widgets/maison_card.dart';
import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  TextEditingController _searchTextController = new TextEditingController();
  String filter;
  List<Maison> _maisons = maisons;

  @override
  void initState() {
    super.initState();
    _searchTextController.addListener(() {
      print(_searchTextController.text);
      filter = _searchTextController.text;
    });
  }

  @override
  void dispose() {
    _searchTextController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: <Widget>[
          Container(
            height: MediaQuery.of(context).size.width * 0.70,
            decoration: …
Run Code Online (Sandbox Code Playgroud)

flutter

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

Codeigniter - uri段

我需要创建一个这样的网址:www.example.com/index.php/scheda/name-surname-id.html

所以我创建了Scheda控制器,这是代码:

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

class Scheda extends CI_Controller{

    function __construct(){
        parent::__construct();
    }

    function index(){
        $name_scheda = $this->uri->segment(2);
        //i need only the id for the search into db
        $id = substr($name_scheda, strripos($name_scheda,'-')+1, strlen($name_scheda));

        echo "name:".$id;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是当我在地址栏中写下网址时,我得到了404 error...有人可以帮助我理解为什么吗?

controller codeigniter

0
推荐指数
1
解决办法
1761
查看次数

如何使用symfony2读取Excel文件?

我安装ExcelbundlePhpExcel库.我想读取我发现这个功能的excel文件.

我怎么用呢?有什么建议吗?

public function xlsAction()
{
    $filenames = "your-file-name";
    $phpExcelObject = $this->get('phpexcel')->createPHPExcelObject($filenames);

    foreach ($phpExcelObject ->getWorksheetIterator() as $worksheet) {
        echo 'Worksheet - ' , $worksheet->getTitle();
        foreach ($worksheet->getRowIterator() as $row) {
            echo '    Row number - ' , $row->getRowIndex();
            $cellIterator = $row->getCellIterator();
            $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
            foreach ($cellIterator as $cell) {
                if (!is_null($cell)) {
                    echo '        Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue();
                    }
                }
        }
    } …
Run Code Online (Sandbox Code Playgroud)

phpexcel symfony

-3
推荐指数
1
解决办法
4424
查看次数