您好我想将一个echo的结果存储在一个变量中,我希望结果不是字符串本身... 我在做的是:
ob_start();
echo "<script>document.write(window.innerWidth);</script>";
$content = ob_get_clean();
echo 'Before:'.$content.'<br/>'; //I need results of this echo which is : "<script>document.write(window.innerWidth);</script>1366" in my case( i need that 1366 thing :)
//What i tried:
$content = str_replace('<script>document.write(window.innerWidth);</script>','',$content);
echo 'After:'.$content.'<br/>'; //Result is nothing :) without those things nothings left :)
//I want to store that 1366 in a $width :)