Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 返回空白作为下划线_Html_Mysql_Codeigniter - Fatal编程技术网

Html 返回空白作为下划线

Html 返回空白作为下划线,html,mysql,codeigniter,Html,Mysql,Codeigniter,我需要在从mysql表返回的地址的最后部分的任何空格中加下划线。问题是我不认为我可以只修改模型中的SQL,因为我还需要在value=”“部分返回带有空格的原始值。我刚刚开始学习php/html,所以不确定这是否可行。下面是视图中我需要修改的代码部分 您还可以使用CI handy helper函数url_title()来加载url helper <input type="button" class="btn btn-success" value="<?php echo $row['

我需要在从mysql表返回的地址的最后部分的任何空格中加下划线。问题是我不认为我可以只修改模型中的SQL,因为我还需要在
value=”“
部分返回带有空格的原始值。我刚刚开始学习php/html,所以不确定这是否可行。下面是视图中我需要修改的代码部分



您还可以使用CI handy helper函数url_title()来加载url helper

<input type="button" class="btn btn-success" value="<?php echo $row['brand'];?>" onClick="document.location.href = ('http://localhost/CodeIgniter_2.1.2/index.php/controller/community/<?php echo url_title($row['brand'],'_');?> ' );">

<?php } ?>

太完美了。感谢您及时回复MaggiQall!谢谢你的额外提示。我也将对此进行研究。我刚刚在CI文档中发现,如果您在url_title中传递第三个参数,则字符串的大小写将从大写改为小写
<input type="button" class="btn btn-success" value="<?php echo $row['brand'];?>" onClick="document.location.href = ('http://localhost/CodeIgniter_2.1.2/index.php/controller/community/<?php echo url_title($row['brand'],'_');?> ' );">

<?php } ?>