php - 每行打印 ">"

标签 php

如何在每一行前打印一个“>”?

if ($quoteid) {
echo ' 
> '.$quote['message'].' 
'; 
}

目前它看起来像这样:

> I would move Heaven and Hell and anything in between to get to you. 
You wouldn't be safe anywhere if I was mad at you.
And that's not bull; that's truth. I've went up against people.
You could pull a gun on me and if I'm mad at you I'm coming forward.
You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.

我希望它看起来像这样:

> I would move Heaven and Hell and anything in between to get to you. 
> You wouldn't be safe anywhere if I was mad at you.
> And that's not bull; that's truth. I've went up against people.
> You could pull a gun on me and if I'm mad at you I'm coming forward.
> You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.

最佳答案

if ($quoteid) {
    // Replace new line with new line + "> "
    echo '>' . str_replace("\n", "\n> ", $quote['message']);
}

关于php - 每行打印 ">",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3237052/

相关文章:

php - 用于验证 facebook 页面 url 的正则表达式

php - 我可以将所需文件的全部内容存储在 JavaScript 变量中吗?

PHP 将 MySQL 数据回显到 HTML 表中

javascript - Codeigniter 上的 AutoSuggest (Ajax) - 404 错误

php - 不存储 POST 数据 (json)

php - 如何在 foreach 循环中的隐藏字段中分配唯一值

javascript - 将 javascript 变量发布到 PHP。

javascript - 使用 ajax 请求调用 .php 文件 - wordpress

php - 无法包含 dbconenct.php

javascript - Php Mysql Ajax 插入多行