小编Ift*_*din的帖子

为什么在Laravel 5.8中创建外键失败?

下面的迁移脚本在旧版本的Laravel中运行平稳,但是我将其添加到了新的Laravel 5.8中并运行了该脚本。我越来越Error: foreign key was not formed correctly

评估迁移:

public function up() { 
    Schema::create('evaluation', function (Blueprint $table) { 
        $table->increments('id'); 
        $table->integer('user_id')->unsigned()->index(); 
        $table->timestamps();
        $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
    });
}
Run Code Online (Sandbox Code Playgroud)

用户迁移:

public function up() { 
    Schema::create('users', function (Blueprint $table) { 
        $table->bigIncrements('id'); 
        $table->timestamps();
    });
}
Run Code Online (Sandbox Code Playgroud)

mysql laravel eloquent

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

如何在 PHP 中更改数组的键?

我有以下数组:

array(10) {
  [0]=>
  array(2) {
    ["id"]=>
    string(2) "73"
    ["position"]=>
    string(1) "1"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(2) "58"
    ["position"]=>
    string(1) "2"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(2) "82"
    ["position"]=>
    string(1) "3"
  }
  [3]=>
  array(2) {
    ["id"]=>
    string(2) "84"
    ["position"]=>
    string(1) "4"
  }
  [4]=>
  array(2) {
    ["id"]=>
    string(2) "74"
    ["position"]=>
    string(1) "5"
  }
  [5]=>
  array(2) {
    ["id"]=>
    string(2) "59"
    ["position"]=>
    string(1) "6"
  }
  [6]=>
  array(2) {
    ["id"]=>
    string(2) "72"
    ["position"]=>
    string(1) "7"
  }
  [7]=>
  array(2) {
    ["id"]=>
    string(2) "78"
    ["position"]=> …
Run Code Online (Sandbox Code Playgroud)

php arrays sorting

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

如何为我的 Laravel 应用程序制作 Web 安装程序?

我知道@RachidLaasri/LaravelInstaller,但它是我想要的一种不同的东西。

我想做一些类似的事情,转到 localhost::8000/installer 这样的 URL。然后,它会显示一个超级管理员注册页面,即电子邮件、密码和用户名。注意:我想消除让我的超级管理员应用程序用户进入 UsersTableSeeder 进行配置的能力。

然后,当我单击安装时,它会迁移我的种子类。我目前正在观看命令行应用程序,但仍然无法真正弄清楚如何解决这个问题。

任何建议/提示将不胜感激。

php laravel laravel-5

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

为什么我收到 Swift_TransportException: Unable to connect with TLS encryption in Server?

我已经从旧服务器迁移到新服务器。新服务器有相当大的变化。旧服务器使用 PHP5.6和 phalcon 3.2,新服务器使用 PHP7.3和 phalcon 3.4.4

在旧服务器电子邮件发送工作顺利,但在新服务器中,它抛出以下错误:

Swift_TransportException:无法使用 TLS 加密连接

两个站点中的服务器邮件配置为:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)

注意:旧站点已开启http,新站点已开启https

php email swiftmailer phalcon

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

Ajax没有将变量传递到另一个页面吗?

我想在用户email单击订阅按钮时将其保存到数据库。但是,当我输入电子邮件并单击“订阅”按钮时,它将传递一个空数组!

订阅表格代码:

<form id="cx-subscribe-user">
    <input type="text" name="email" id="email" placeholder="Enter Your Email" />
    <button type="submit" id="subscribe-button">Subscribe</button>
</form>
Run Code Online (Sandbox Code Playgroud)

js代码:

$('#cx-subscribe-user').on('click', function (e) {
    e.preventDefault();
    var email = $('#email').val();
    $.ajax({
        type: "GET",
        url: "subscribe-the-user.php",
        processData: false,
        dataType: 'json',
        data: {email: email},
        success: function(data) {
            console.log('saved scucess');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

subscribe-the-user.php文件中,我试图var_dump请求,但它正在打印空数组:

var_dump($_GET);exit;
Run Code Online (Sandbox Code Playgroud)

var_dump中,我收到这个空数组 array(0) {}

javascript php arrays ajax

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

标签 统计

php ×4

arrays ×2

laravel ×2

ajax ×1

eloquent ×1

email ×1

javascript ×1

laravel-5 ×1

mysql ×1

phalcon ×1

sorting ×1

swiftmailer ×1