Dosya dnm.php bu suna benziyor:
<?php
echo 'Hello world.';
?>
Ben böyle bir şey yapmak istiyorum:
$test = include('test.php');
echo $test;
// Hello world.
Herkes doğru yolu beni işaret edebilir?
Edit:
Benim asıl hedefi bir veritabanından HTML ile iç içe PHP kod çekin ve onu işlemek için oldu. İşte ben yapıyorum sona ne:
// Go through all of the code, execute it, and incorporate the results into the content
while(preg_match('/<\?php(.*?)\?>/ims', $content->content, $phpCodeMatches) != 0) {
// Start an output buffer and capture the results of the PHP code
ob_start();
eval($phpCodeMatches[1]);
$output = ob_get_clean();
// Incorporate the results into the content
$content->content = str_replace($phpCodeMatches[0], $output, $content->content);
}