且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用 PHP 获取 *** 视频标题

更新时间:2023-02-21 08:07:38

使用 错误控制运算符在file_get_contents之前.

It may work to use the error control operators before file_get_contents.

类似于:

if($content = @file_get_contents("http://***.com/get_video_info?video_id=" . $video_id))

它应该删除错误并使用它在您的 if 语句中返回 false.

It should remove the error and use it to return false in your if statement.

否则你可以只使用 try/catch 语句(见 Exceptionsa>):

Else you can just use try/catch statement (see Exceptions):

try{
    // Code
}
catch (Exception $e){
    // Else code
}