PHP海补知识(3)-- 错误抑制

使用@抑制住警告,可做出提示处理

$file="C:\1.txt";
@fp=fopen($file,'r');
//  if the file is not exist, it won't throw an exception
//handle the exception manually
if(!fp){
    die("file not exist!");
}
else{
    //do sth
}
这是我的个人日记本
原文地址:https://www.cnblogs.com/valentineisme/p/3972259.html