首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php heredoc错误

php heredoc错误
EN

Stack Overflow用户
提问于 2013-02-25 12:48:01
回答 2查看 113关注 0票数 1

我有一个关于php heredoc的问题。我正试着做这样的事情。

代码语言:javascript
复制
$heredoc = <<<_HERE
This is the way
I try to use the
heredoc, but apparently
something is going wrong
_HERE;

显然,我应该得到这个:

代码语言:javascript
复制
This is the way
I try to use the
heredoc, but apparently
something is going wrong

但我得到的是:

这是我尝试使用heredoc的方式,但显然有些地方出了问题。

它没有格式化,其主要思想是获得格式化的文本。

有人能帮帮我吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-02-25 12:51:05

使用pre标签:

代码语言:javascript
复制
$heredoc = <<<_HERE
<pre>
This is the way
I try to use the
heredoc, but apparently
something is going wrong
</pre>
_HERE;
票数 2
EN

Stack Overflow用户

发布于 2013-02-25 12:52:29

试一试

代码语言:javascript
复制
<?php
    $heredoc = <<<_HERE
This is the way
I try to use the
heredoc, but apparently
something is going wrong
_HERE;

    echo "<pre>";
    echo $heredoc;
    echo "</pre>";
?>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15060306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档