Heim  >  Artikel  >  Backend-Entwicklung  >  php怎么保存文件到客户端

php怎么保存文件到客户端

WBOY
WBOYOriginal
2016-06-13 10:14:36904Durchsuche

php如何保存文件到客户端?
用客户机登录后台管理系统,服务器在远程、 
  有个保存的按钮,点了 以后,会在服务器段生成一个txt文件。可是我不需要他在服务器段生成,我只想它在客户端生成、
  应该怎么办呢?
  听说是用ActiveXObject,我是个菜,JS不太熟悉,哪位大哥大姐,能帮个忙, 给解决一下?
  来段可以用的代码?

------解决方案--------------------
下面的代码能生成一个txt文件给客户端下载,不知道是不是你需要的

PHP code
<?phpheader ('Content-Disposition: attachment; filename="download.txt"');echo 'txt contents.....';?><br><font color="#e78608">------解决方案--------------------</font><br>不会在服务端留下痕迹~你用上面的代码写个php运行一下就明白了<br>
探讨
回楼上,生成的txt不是要先存到服务器,再下载到客户端么?
我现在不能在服务器端留下痕迹…怎么办啊?
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn