程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

php concatenation is removing php output?

发布于2023-05-25 21:18     阅读(1030)     评论(0)     点赞(20)     收藏(5)


I have a php variable that is created like so:

$scholarshipTitleOutput = ($scholarship['field_sec1_title']['#items'][0]['value']);

If I print the variable by itself it renders correctly, but I want the output to be placed between two header tags. What I would expect to be able to do it echo out the following...

echo "<h2>" . $scholarshipTitleOutput . "</h2>";

But this removes the variable output from the page for some reason. I've tested further and found that I can concatenate after echoing the variable to do things like add a space...

echo $scholarshipTitleOutput . " ";

So what is it about that first example that is completely removing the variable from outputting on the page?


解决方案


It works fine when I try it. You can also try

echo "<h2>{$scholarshipTitleOutput}</h2>";


所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:http://www.phpheidong.com/blog/article/546121/3cc3b67e9e766fb287af/

来源:php黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

20 0
收藏该文
已收藏

评论内容:(最多支持255个字符)