file_get_contents synchronous or asynchronous

前端 未结 3 1149
花落未央
花落未央 2021-01-14 02:41

Today I came across one situation.

I am using file_get_contents to get token from a file for a user.

$data=file_get_contents(\"http://ex         


        
3条回答
  •  无人共我
    2021-01-14 03:03

    file_get_contents is synchronous. You can get FALSE sometimes because of different reasons like network fail, DNS fail etc.

    Use curl instead: it's faster and more customizable. You can wait for good response recursive if you need 100% success.

提交回复
热议问题