Hi there,
Good day.
My Code worked on CI V4.4.3.
On my MacOS env it works quite well.
Mamp Pro with PHP V8.2.0
When I deployed to my local CentOS V7 with PHP V8.2.16. But my app doesn't work on CentOS now.
Error. Call to undefined function display_error()
I already googled some articles and solutions, but these information don't work on my situation.
My code as below,
view page:
the last line is <small class="text-danger"><?= isset($validation) ? display_error($validation, 'email') : '' ?></small>, the erro function trigged from there.
Code:
<form action="<?= base_url('auth/check') ?>" method="post" autocomplete="off">
<?php $validation = \Config\Services::validation(); ?>
<?= csrf_field(); ?>
<?php if( !empty( session()->getFlashdata('fail') ) ) : ?>
<div class="alert alert-danger"><?= session()->getFlashdata('fail'); ?></div>
<?php endif ?>
<!-- Form Group (email address)-->
<div class="mb-3">
<label class="small mb-1" for="inputEmailAddress">Email</label>
<input type="text" name="email" class="form-control" placeholder="Enter your email" value="<?= set_value('email') ?>">
<small class="text-danger"><?= isset($validation) ? display_error($validation, 'email') : '' ?></small>
</div>
......
......
And my controller as this,
Code:
class AuthController extends BaseController
{
protected $helpers = ['url', 'form']; // this is the original style. it work on MacOS.
public function login()
{
// helper('form'); // I tried to fix my err and inserted here again. it doesn't work on my CentOS.
return view('auth/auth-login');
}
I also tested add the help in BaseController as below since I found one post suggested as this way.
Code:
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = ['form'];
All of these methods don't work.
Could anyone give me other suggestion?
thank you so much.
Best Regards.
Nano HE.