我遵循了升级指南(在我从 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-fixcomposer 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“缺少模板异常"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
不能使用 'Object 作为类名,因为它是保留的Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作为类名,因为它是保留的 Cake 2.2.x)
OAuth 重定向后会话丢失Session is lost after an OAuth redirect(OAuth 重定向后会话丢失)
Cakephp 3.x 中的分页排序Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分页排序)
CakePHP 多个应用程序的共享核心CakePHP Shared core for multiple apps(CakePHP 多个应用程序的共享核心)
在 CakePHP 3 上登录 [ Auth->identify() ] 始终为 falLogin [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登录 [ Auth-identify() ] 始终为 false)
致命错误:允许的内存大小为 134217728 字节已用尽Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命错误:允许的内存大小为 134217728 字节已用尽