zoukankan      html  css  js  c++  java
  • PHP之打开文件

    今天在看《PHP与MySQL程序设计(第四版)》(ISBN: 9787115253521)的时候,183页,如下图:

     

    尝试:$file = fopen("F:Books投行笔记.txt","R");

    报警告: Warning: fopen(F:Books投行笔记.txt): failed to open stream: No error in D:Apache24x64htdocsTest.php on line 383

    实际上就是打开失败。

     

    尝试:$file = fopen("F:Books投行笔记.txt","r");

    报警告:Warning: fopen(F:Books投行笔记.txt): failed to open stream: No such file or directory in D:Apache24x64htdocsTest.php on line 383

    看来是参数正确,但文件名有问题。把文件名改为1.txt,可以打开。

     

    尝试把r改为R:

    尝试:$file = fopen("F:Books1.txt","R");

     

    报警告: Warning: fopen(F:Books1.txt): failed to open stream: No error in D:Apache24x64htdocsTest.php on line 383

    还是失败。

     

    总结:

    一、fopen不支持中文名,按说这是不应该的,一定是哪里设置得有问题或者某个选项没开,待查。

    二、fopen的第二个参数应当是小写。我这里的PHP版本是php7.0.8,不知道5.3是不是这样的。

     

    经查,书上的有问题,应当是小写

  • 相关阅读:
    centos 给终端设快捷键
    centos 给鼠标右击添加 “打开终端” 菜单项
    centos 6.X 安装输入法
    centos U盘安装
    js的构造函数
    onresize的定义方式
    两个时间对比
    AMD和CMD的区别
    spring加载配置文件
    cglib代理
  • 原文地址:https://www.cnblogs.com/Sabre/p/5736607.html
Copyright © 2011-2022 走看看