Search code examples
laravellaravel-artisan

Laravel. php artisan display return [];


When I use php artisan command, it display "return [];" Here is a screenshot Above the header of my web page there is "return []"; too. Does anyone know what this is caused by?


Solution

  • A Laravel configuration file is a PHP file that contains an array, when your application is initialised Laravel loads each configuration file (config/*.php) and adds the array to your configuration.

    The problem you're experiencing appears to be due to the fact that your application has a configuration file that is being loaded not as PHP but instead as a text file. This can be caused by a config file missing the opening <?php, which is required for the file to be treated as PHP. For example, if you create a file in config called example.php with the following contents:

    return [
    
    ];
    

    You would see the behaviour you're experiencing in the screenshot. Therefore you should visit your config directory and identify any file that is missing the opening <?php.