douxingmou4533 2014-03-12 17:52
浏览 40
已采纳

读取客户端和服务器端的文件之间的区别

What exactly is the difference between accessing a file through HTML (e.g. <img src="xxx.jpg">) or JavaScript, and using PHP to read a file. The file is still just on the server in both cases, isn't it?

What makes using PHP to access the server's file system different to someone just typing in the URL of the file (provided they know what it is)?

  • 写回答

4条回答 默认 最新

  • duanjunjie0196 2014-03-12 18:00
    关注

    For static files like (images, HTML, etc) there is no difference, if you directly enter the file URI or read it internally and print the buffer through PHP (at this case the file URI will change for sure).

    For dynamic files (PHP files), the same concept is true, if you enter the file URI directly you will get the output of that file, and if you read it internally (There are two types: include and read its source). but in most cases, PHP files are designed for execution not for printing the source, therefore, in both cases:

    • When you try to read static files by PHP its just resource wasting if there is no need to use PHP.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码