问题
I installed Codeigniter 4.0.2 and did following changes:
1-
CI_ENVIRONMENT = development
in .env file2-
SetEnv CI_ENVIRONMENT development
in .htaccess in public folder3- Added
$useKint = true;
in main index.php file in public folder
When I open at localhost, welcome page is rendered but no Debug Toolbar is rendered. Am I missing anything?
回答1:
The debug toolbar will be there in bottom right cornor with a codigniter code logo
- Click that in order to open the debug bar.
Click the icon you will be able to see debug bar like this.
回答2:
Here are some stuffs you can check with a fresh CI4 installation :
- Your environment is really on development (you can check it in the footer of your welcome page). If not, be sure to set CI_ENVIRONMENT = development in your .env. Watch out because fresh CI4 doesn't come with a .env file but with a env file. Be sure to rename it.
Make sure you have
defined('CI_DEBUG') || define('CI_DEBUG', 1);
in your app/Config/Boot/development.php fileTry to launch your app with the command line
php spark serve
so you can grab some informations about your app accessing the toolbar.
Make sure you have a variable named
$globals
in app/Config/Filters.php with 'toolbar' as a value of the 'after' key and 'toolbar' being correctly mapped with the toolbar class into$aliases
public $aliases = [ 'csrf' => \CodeIgniter\Filters\CSRF::class, 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, 'honeypot' => \CodeIgniter\Filters\Honeypot::class ];
public $globals = [ 'before' => [ //'honeypot' // 'csrf', ], 'after' => [ 'toolbar', //'honeypot' ], ];
It can be some starting points, hope this helps.
回答3:
Today I've faced the same issue in my very first attempt to use CI4 (with XAMPP)... The only one change I've made on the CI4 framework was to rename the env file to .env and then I set CI_ENVIRONMENT = development in .env file
I've found 2 solutions:
Use the "php spark serve" command to start my project instead of XAMPP
Point $baseURL in app\Config\App.php to my project's public folder
Hope this helps! Best regards
来源:https://stackoverflow.com/questions/60832190/debug-toolbar-in-codeigniter-4-not-working