开发者

CodeIgniter helper inside controllers

开发者 https://www.devze.com 2023-02-01 03:24 出处:网络
can i call helper functions inside controller classes? let\'s say i have this controller with the _open_form method

can i call helper functions inside controller classes?

let's say i have this controller with the _open_form method

class User extends Controller {
 function _open_form($action){
  print_r(form_open($action));
 }
}

i tried echoing out the result of form_open() but it returns null. it seems that helper functions can't be called ins开发者_开发知识库ide controllers

if your wondering why i need to use it inside the controller instead in the view because we are required to use the given template parser xD


lolololol

i figured it out. it seems that the view file did not escaped the result of form_open()

try using htmlentities(form_open($action));

it should escape < and > symbols

lol sorry for the stupid question :))


Did you load the helper file?

$this->load->helper('form');


Yes you just need to load it inside your function:

$this->load->helper('form');

More details here http://codeigniter.com/user_guide/general/helpers.html

0

精彩评论

暂无评论...
验证码 换一张
取 消