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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。