how to handle parse error for eval function in php

后端 未结 3 678
陌清茗
陌清茗 2021-01-19 09:25

I\'m trying to use the eval function for php. but I\'m stuck in handling the parse error. like considering if I have edge cases like 1.. or 1++ if gives me parse error:synta

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 10:04

    $response = @eval($string);
    if (error_get_last()){
        echo 'Show your custom error message';
        //Or you can 
        print_r(error_get_last());
    }
    

提交回复
热议问题