我遵循了升级指南(在我从 3.6
升级到 3.8
之后)但我收到这个错误:
I followed the upgrade guide (after I upgraded from 3.6
to 3.8
) but I get this error:
错误:[CakeViewExceptionMissingTemplateException] 模板文件Errorerror500.ctp";不见了
Error: [CakeViewExceptionMissingTemplateException] Template file "Errorerror500.ctp" is missing
....
如果要自定义此错误消息,请创建 srcTemplateErrorfatal_error.ctp
在升级过程之后,我的模板移动到 app_name emplates
目录并重命名为 *.php
而不是 *.ctp
.我用新路径更新了 app.php
和 app.default.php
:
After the upgrade procedure my templates moved to app_name emplates
directory and renamed to *.php
instead of *.ctp
. I updated the app.php
and app.default.php
with the new paths:
'App' => [
'namespace' => 'App',
'encoding' => env('APP_ENCODING', 'UTF-8'),
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'),
'base' => false,
'dir' => 'src',
'webroot' => 'webroot',
'wwwRoot' => WWW_ROOT,
//'baseUrl' => env('SCRIPT_NAME'),
'fullBaseUrl' => false,
'imageBaseUrl' => 'img/',
'cssBaseUrl' => 'css/',
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [ROOT . DS . 'templates' . DS],
'locales' => [ROOT . DS . 'Locale' . DS],
],
],
但应用程序仍然在寻找带有 .ctp
扩展名和 srcTemplate...
But still the application is looking for the template files with .ctp
extension and under srcTemplate...
我错过了什么?
根据我的经验:
将 CakePHP 3.x 升级到 4.x
composer update
composer require --update-with-dependencies "phpunit/phpunit:^8.0"
composer require --update-with-dependencies "cakephp/cakephp:4.0.*"
mkdir cakephp4 &&cd cakeph4
;并运行 composer create-project --prefer-dist cakephp/app:4.* .
;<?php declare(strict_types=1);
composer cs-check
然后 composer cs-fix
composer update
composer require --update-with-dependencies "phpunit/phpunit:^8.0"
composer require --update-with-dependencies "cakephp/cakephp:4.0.*"
mkdir cakephp4 && cd cakeph4
; and run composer create-project --prefer-dist cakephp/app:4.* .
;<?php declare(strict_types=1);
composer cs-check
then composer cs-fix
这篇关于CakePHP:从 3.6.x 升级到 4.0“缺少模板异常"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!