How do I capture the result of an echo() into a variable in PHP?

前端 未结 4 738
攒了一身酷
攒了一身酷 2020-12-19 12:31

I\'m using a PHP library that echoes a result rather than returns it. Is there an easy way to capture the output from echo/print and store it in a variable? (Other text has

4条回答
  •  心在旅途
    2020-12-19 12:48

    You should really rewrite the class if you can. I doubt it would be that hard to find the echo/print statements and replace them with $output .=. Using ob_xxx does take resources.

提交回复
热议问题