这是什么标签,这是如何执行的?我的意思是%content%tag
$body = str_replace('%content%', $leftcol, $template);
答案 0 :(得分:4)
这是替换功能。它将$ template变量中的'%content%'字符串更改为$ leftcol变量的内容。
$template = 'some text, some text, %content%';
$leftcol = 'new text';
$body = str_replace('%content%', $leftcol, $template);
$ body现在:
一些文字,一些文字,新文字
查看http://php.net/str_replace了解详情。
答案 1 :(得分:3)
这不是PHP标签。该函数仅使用%content%
变量中的$leftcol
值替换字符串$template
。请参阅http://php.net/str_replace以获取进一步的帮助。
答案 2 :(得分:2)
$body
被$template
上的值替换后, '%content%'
会在$leftcol
上收到字符串。
<?php
// Provides: <body text='black'>
$body = str_replace("%content%", "black", "<body text='%content%'>");
?>