我如何阅读“,"作为“< br/>"在PHP/MySQL的? [英] How do I read a "," as "<br />" in PHP/MySQL?

查看:80
本文介绍了我如何阅读“,"作为“< br/>"在PHP/MySQL的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个MySQL数据库和一个表,并且在行中有很多,",我希望当它们在PHP的屏幕上输出时,切换到"
",而不是昏迷,我该怎么办?

So I have this MySQL database and a table and in the rows there a lot of "," in them, and I wish when they are output on the screen with PHP to be switched to "
" instead of coma, how do I do that?

我的意思是,这是一个示例,它是这样的:你好,不,谢谢,而不是像这样输出,我希望它输出为: 你好 不 谢谢

I mean, this is a example, it stands like this: hello,no,thanks and instead of being output like that I would like it to be output as: hello no thanks

我该怎么做?有人可以帮我吗?会非常友好的.

How do I do that? Could someone do it for me? Would be very friendly.

推荐答案

假定没有CSV引用问题:

Assuming there are no CSV quoting issues:

$newStr = str_replace( ',', '<br>', $string );

看到您的回滚之后,我发现您实际上想将,替换为newline字符,例如\r\n\r\n:

After seeing your rollback, i see that you actually want to replace the , with a newline character such as \r, \n or \r\n:

$newStr = str_replace( ',', "\n", $string );

这篇关于我如何阅读“,"作为“&lt; br/&gt;"在PHP/MySQL的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆