在之前打开/没有@ [英] fopen with/without @ before it

查看:84
本文介绍了在之前打开/没有@的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经见过在 fopen 之前使用 @ 的代码示例,如

  $ fh = @fopen($ myFile,'w'); 

这个 @

解决方案

它可以消除表达式可能显示的错误。



更多关于此处


$ b例如:

  file_get_contents('file_does_not_exist'); $ b 

//显示错误

@file_get_contents('file_does_not_exist'); //这不是


I've seen code samples that use an @ before fopen as in

$fh = @fopen($myFile, 'w');

What's the significance of this @?

解决方案

It suppresses errors an expression may display.

You can read more about it here.

Example:

file_get_contents('file_does_not_exist'); //this shows an error

@file_get_contents('file_does_not_exist'); //this does not

这篇关于在之前打开/没有@的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆