简体   繁体   中英

Understanding PHP code includes

I am pretty new to PHP. I am going through a website and am trying to find a source of some of the content and have come across what looks like where the source is, but I cannot decipher the code. Can someone help me understand what this means?

<?php

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

Thanks!

I have copied your code and added comments that (hopefully) explain what is going on.

<?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
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM