0

我想做相当于包含但在字符串上,而不是在文件路径上。我将获取文件的内容,然后操作它的内容,然后将更改后的代码/字符串作为 PHP 代码包含在调用 PHP 页面中。(这将仅供内部使用,所以它不是通常的安全风险)

例子:

<?php
    //This is "code.php", a file that has some code (elided in this example)
    <REPLACE_ME_WITH_OTHER_CODE>
?>

<?php
    $code = $myObj->manipulate( file_get_contents( "code.php" ) );

    //Now include it (eval?)
    eval( $code );

    //Or some other way?
    include_code( $code );
?>
4

0 回答 0