【问题标题】:php error-log on UserFrosting after loading main page加载主页后在 UserFrosting 上的 php 错误日志
【发布时间】:2016-10-01 15:56:54
【问题描述】:

我正在尝试安装 UserFrosting 加载主页后出现这些错误

[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 6. Composer\Autoload\includeFile() C:\Server\userfrosting\vendor\composer\ClassLoader.php:301
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 5. Composer\Autoload\ClassLoader->loadClass() C:\Server\userfrosting\initialize.php:25 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 4. spl_autoload_call() C:\Server\userfrosting\initialize.php:25 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 3. UserFrosting\UserFrosting->setupGuestEnvironment() C:\Server\userfrosting\initialize.php:193 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 2. require_once() C:\Server\index.php:10 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 1. {main}() C:\Server\index.php:0 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP Stack trace: 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP Strict standards: Declaration of UserFrosting\User::fresh() should be compatible with Illuminate\Database\Eloquent\Model::fresh(array $with = Array) in C:\Server\userfrosting\models\database\User.php on line 570 

我找不到问题 感谢您的帮助

【问题讨论】:

    标签: php error-handling userfrosting


    【解决方案1】:

    错误PHP Strict standards: Declaration of UserFrosting\User::fresh() should be compatible with Illuminate\Database\Eloquent\Model::fresh(array $with = Array) in C:\Server\userfrosting\models\database\User.php on line 570 表示UserFrosting\User::fresh() 方法应该接受与Illuminate\Database\Eloquent\Model::fresh(array $with = Array) 相同类型的参数。

    可以使用以下代码重现该问题:

    test.php

    <?php
    class A {
      public function test ($arg = 'default value') {
        echo $arg;
      }
    }
    
    class B extends A {
      public function test () {
        echo __METHOD__;
      }
    }
    
    $b = new B;
    $b->test();
    

    运行脚本:

    $ php test.php
    PHP Warning:  Declaration of B::test() should be compatible with A::test($arg = 'default va...') in /home/ruslan/tmp/src/test.php on line 12
    

    要修复它,我们只需修改派生类中的test 方法根据父方法

    class B extends A {
      public function test ($arg = 'X value') {
        echo __METHOD__;
      }
    }
    

    运行脚本:

    $ php test.php 
    B::test
    

    【讨论】:

      猜你喜欢
      • 2016-11-17
      • 2012-01-29
      • 2018-06-20
      • 2017-07-05
      • 1970-01-01
      • 2011-08-14
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多