Error: FlashHelper could not be found.

Asked 2 years ago, Updated 2 years ago, 58 views

I use CakePHP Ver.2.5.8.

I tried Simple authentication and approval application following the official tutorial.

However, if FlashHelper is not present, an error occurs.

Missing Helper
Error: FlashHelper could not be found.

Error: Create the class FlashHelper below in file: app/View/Helper/FlashHelper.php 

<?php
classFlashHelper extensions AppHelper {

}

This is how you get an error.

app/View/Helper directory and try ls
There is only AppHelper.php.

Among lib/Controller/Component is FlashHelper.php.

How should I interpret this?

Your question may be insufficient, but you may not understand enough about the helper and the components.

I look forward to hearing from you.

php cakephp

2022-09-30 20:12

1 Answers

FlashComponent and FlashHelper appear to have been added since CakePHP 2.7.

Not recommended

  • SessionComponent::setFlash() is deprecated.Use FlashComponent instead
  • SessionHelper::flash() is deprecated.Use FlashHelper instead

--- Quoted from http://bakery.cakephp-users.jp/2015/07/14/cakephp_2_7_0_released/

Earlier versions seemed to use SessionComponent and SessionHelper as described above, but the description is in the documentation for the session components.

Sessions—CakePHP Cookbook 2.x Documentation > Create Notification Messages

If you go to the app/View/Helper directory and ls, you'll find only AppHelper.php.

Components and helpers can be created by the user in addition to those that come with CakePHP.It's no surprise that there's only AppHelper.php in app/ where you put your own (application-specific) stuff.The original location is lib/.

In fact, if you look at the CakePHP 2.7.0 file tree on Github, you'll see

The file exists.So, rather,

Among lib/Controller/Component is FlashHelper.php.

This is more of a mystery. I can't find the file FlashHelper.php in the 2.5.8 tree...


2022-09-30 20:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.