我通常这样编码:
$output .= 'custom code';
$output .= 'another line of custom code';
$output .= 'more code';
return $output;
Run Code Online (Sandbox Code Playgroud)
现在我想使用ob_start(),ob_get_contents()和ob_get_clean(). 在我的示例中使用它的最有效方法是什么?
这将返回与您给出的示例相同的内容:
ob_start();
echo 'custom code';
echo 'another line of custom code';
echo 'more code';
return ob_get_clean();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9723 次 |
| 最近记录: |