How to list all PHP variables in a file?

后端 未结 3 1558
不知归路
不知归路 2021-01-07 11:53

I have a PHP file with PHP Variables inside.
Example:

Hi ,
Can you please send me an email ?

I would like to

3条回答
  •  情歌与酒
    2021-01-07 12:33

    Use file_get_contents() and preg_match_all():

    $file = file_get_contents('file.php'); 
    preg_match_all('/\$[A-Za-z0-9-_]+/', $file, $vars);
    
    print_r($vars[0]);
    

提交回复
热议问题