capturing echo into a variable

后端 未结 3 683
广开言路
广开言路 2020-12-13 09:15

I am calling functions using dynamic function names (something like this)

$unsafeFunctionName = $_POST[\'function_name\'];
$safeFunctionName   = safe($unsafe         


        
3条回答
  •  余生分开走
    2020-12-13 09:50

    PHP: ob_get_contents

    ob_start(); //Start output buffer
    echo "abc123";
    $output = ob_get_contents(); //Grab output
    ob_end_clean(); //Discard output buffer
    

提交回复
热议问题