gpt4 book ai didi

php - CodeIgniter 2.2.0 form_helper 给出错误

转载 作者:行者123 更新时间:2023-11-28 10:46:06 27 4
gpt4 key购买 nike

我正在尝试使用 form_helper.php codeigniter 2.2.0 的辅助类以下是我尝试执行此操作时发出的错误:

Controller 文件

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

查看文件

<?php 
$attributes = array('class' => 'form-horizontal', 'id' => 'admin-form');
echo form_open($this, $attributes);
?>

错误:

A PHP Error was encountered

Severity: Warning

Message: strpos() expects parameter 1 to be string, object given

Filename: helpers/form_helper.php

Line Number: 53

A PHP Error was encountered

Severity: 4096

Message: Object of class CI_Loader could not be converted to string

Filename: helpers/form_helper.php

Line Number: 61

Although it does print the tag.

What I could be doing wrong here ?

最佳答案

您的代码:

echo form_open($this, $attributes);

不正确。更正为:

echo form_open($YOUR_FORM_ACTION, $attributes);

Reference

出现问题是因为您传递的是对象 $this,而不是表单操作(字符串)。

关于php - CodeIgniter 2.2.0 form_helper 给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27294606/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com