0

由于我将我的网站移植到 codeigniter,我想知道我是否真的需要将常规 html 代码转换为 codeigniter 编码标准。

例如,我有以下 html 代码:

<input type="text" id="first_name" name="first_name" size="32" maxlength="32" value="<?php echo $first_name ?>">

在 codeigniter 中,我可以执行与上述相同的操作或使用以下代码:

$format = 'size="32" maxlength="32"';

echo form_input('first_name', '$first_name', $format);

那么我应该关注哪一个呢?

4

2 回答 2

2

这样做是为了方便:

echo '<input type="text" id="first_name" name="first_name" size="32" maxlength="32" value="'.$first_name.'">';

它更好,更值得推荐,并且每个浏览器都支持该死的肯定

于 2012-08-22T06:59:50.793 回答
0

Leave your code as it is, there is no standard in writing HTML here, use whatever suits you best and whatever is more readable for you. Your way is much more rapid, than CodeIgniter's as it's basically plain html with echo of one variable. CodeIgniter's helper is basically an option for lazy ones to get things up faster, if you're familiar with them. If you work in a team and then ask for your designer or the one that's usually working with frontend and he's not familiar with CodeIgniter you will have to change things by yourself.

于 2012-08-22T08:25:17.763 回答