理解PHP代码包括

时间:2014-08-01 22:33:36

标签: php

我是PHP新手。我正在浏览一个网站,并试图找到一些内容的来源,并且看到了源代码的位置,但我无法破译代码。有人能帮我理解这意味着什么吗?

<?php

if (is_file($office_file)) 
    include($office_file);
echo do_shortcode(ob_get_clean());
?>

谢谢!

1 个答案:

答案 0 :(得分:1)

我复制了你的代码并添加了评论(希望)解释发生了什么。

<?php
if (is_file($office_file)) // check if $office_file is a valid file
    include($office_file); // the check passes, so now include the contents of that file inline
echo do_shortcode(ob_get_clean()); // not enough context to know really what this does, but it looks like its printing the result of parsing 'shortcode' from an output buffer
?>