问题描述
有没有办法删除CodeIgniter中的action属性?
Is there a way that I can remove the action attribute in CodeIgniter?
代码通常如下:
form_open_multipart('person/add', $attributes);
我希望我可以省略第一个参数,标记。
I was hoping that I could omit the first parameter so that I could not have an action attribute in the mark-up.
感谢那些可以帮助的人。
Thanks for those who could help.
推荐答案
当然,您可以考虑:
1)动作属性有意义和功能,不知道为什么你想要它
1) The action attribute has a meaning and a function, don't know why you want it out
2)你可以随时传递空字符串:
2) You can always pass it an empty string :
<?php echo form_open('');?>
或<?php echo form_open_multiaction('');?>
提供:
<form action="" method="post">
如果你真的确定,只需打开 form_helper .php
文件,位于 system / helpers / form_helper.php。
In case you're really sure about this, just open up the form_helper.php
file, located in system/helpers/form_helper.php.
第59-65行:
$action OR $action = $CI->config->site_url($CI->uri->uri_string());
$form = '<form action="'.$action.'"';
$form .= _attributes_to_string($attributes, TRUE);
$form .= '>';
并将第60行更改为
$form = '<form ';
form_open_multiaction()只是选择form_open()并添加了enctype属性,所以你改变form_open并且设置为。
现在由您决定,我仍然无法看到为什么空白操作不能满足您的目标。
form_open_multiaction() just picks the form_open() and adds the enctype attribute, so you change form_open() and you're set.
It's up to you now, I still fail to see why an empty action won't suffice to your goals.
这篇关于如何删除Codeigniter中的form_open_multipart()中的action属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!