PHP If file_get_contents fails, do this instead

后端 未结 7 1866
谎友^
谎友^ 2021-01-02 12:23

I have a function to translate the current text string using the Free Bing translator API. I just want to make sure if anything fails or something happens with the Applicat

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 13:19

    You can do like this

    if(@file_get_contents("yourFilePath.txt")){
         echo "success";
    }
    

提交回复
热议问题