简体   繁体   中英

get_file_contents execute the PHP part

I am trying something like this:

$content = get_file_contents("abc.file");
echo $content;

The problem is that abc.file contains some HTML tags along with a php statement:

<?php require_once('a_php_file.php') ?>

How do I get the server to execute the php parts of abc.file before it being echo(ed).

Thanks!

Use include :

include 'abc.file';

Use include() : you might need to make some php configuration changes to let include work on remote files, but typically that's what you do.

Either that or eval() , I think.

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