php - Calling the function inside helper file
958
I have inside my helper class inside helpers/common_helper.php
In this page I have following code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Helper
{
public static function resFormat($response = array())
{
Now I am trying to call this resFormat function from my controller
I have used following code:
public function test()
{
// GET FORM CONTENTs.
$paperFormat = $this->Paper_model->getTest();
$status = 200;
$response = array('param' => null, 'status' => $status, 'data' => $paperFormat);
return response()->json(Helper::resFormat($response), $status);
}
But for some reason I am getting call to undefined function response()
In my autoload.php
$autoload['helper'] = array('common');
Answer
Solution:
Just because declaring your helper file as class, so you can not call helper function directly.
your comm_helper.php should be: