doukang1962 2013-11-02 10:47
浏览 88
已采纳

如何获取函数stream_get_line和fgets的错误?

I have a code where I open a socket connection. From time to time it happens that fgets returns false. I would like to find out why it happens. Is there a function that would provide more details about last error on $handle? Something like preg_last_error, json_last_error, …

The same question can be applied to function stream_get_line().

I use PHP 5.4 and E_ALL is in error_reporting (i.e. it includes even E_NOTICE). No error was thrown.

  • 写回答

2条回答 默认 最新

  • duanshai4484 2013-11-06 14:04
    关注

    More information about stream can be retrieved by using stream_get_meta_data(). However, I solved the issue by rewriting my code to use socket_* functions. The API provides socket_last_error function which helps a lot.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件