【ZZ】一些在php中使用header函数设置http头的示例方法

 
  1. // ok  
  2. header('HTTP/1.1 200 OK');  
  3.   
  4. //设置一个404头:  
  5. header('HTTP/1.1 404 Not Found');  
  6.   
  7. //设置地址被永久的重定向  
  8. header('HTTP/1.1 301 Moved Permanently');  
  9.   
  10. //转到一个新地址  
  11. header('Location: http://www.example.org/');  
  12.   
  13. //文件延迟转向:  
  14. header('Refresh: 10; url=http://www.example.org/');  
  15. print 'You will be redirected in 10 seconds';  
  16.   
  17. //当然,也可以使用html语法实现  
  18. // <meta http-equiv="refresh" content="10;http://www.example.org/ />  
  19.   
  20. // override X-Powered-By: PHP:  
  21. header('X-Powered-By: PHP/4.4.0');  
  22. header('X-Powered-By: Brain/0.6b');  
  23.   
  24. //文档语言  
  25. header('Content-language: en');  
  26.   
  27. //告诉浏览器最后一次修改时间  
  28. $time = time() - 60; // or filemtime($fn), etc  
  29. header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');  
  30.   
  31. //告诉浏览器文档内容没有发生改变  
  32. header('HTTP/1.1 304 Not Modified');  
  33.   
  34. //设置内容长度  
  35. header('Content-Length: 1234');  
  36.   
  37. //设置为一个下载类型  
  38. header('Content-Type: application/octet-stream');  
  39. header('Content-Disposition: attachment; filename="example.zip"');  
  40. header('Content-Transfer-Encoding: binary');  
  41. // load the file to send:  
  42. readfile('example.zip');  
  43.   
  44. // 对当前文档禁用缓存  
  45. header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');  
  46. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past  
  47. header('Pragma: no-cache');  
  48.   
  49. //设置内容类型:  
  50. header('Content-Type: text/html; charset=iso-8859-1');  
  51. header('Content-Type: text/html; charset=utf-8');  
  52. header('Content-Type: text/plain'); //纯文本格式  
  53. header('Content-Type: image/jpeg'); //JPG***  
  54. header('Content-Type: application/zip'); // ZIP文件  
  55. header('Content-Type: application/pdf'); // PDF文件  
  56. header('Content-Type: audio/mpeg'); // 音频文件  
  57. header('Content-Type: application/x-shockw**e-flash'); //Flash动画  
  58.   
  59. //显示登陆对话框  
  60. header('HTTP/1.1 401 Unauthorized');  
  61. header('WWW-Authenticate: Basic realm="Top Secret"');  
  62. print 'Text that will be displayed if the user hits cancel or ';  
  63. print 'enters wrong login data'
VBA的FIND方法是用于在字符串查找指定文本的方法。它的语法如下: ``` expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap) ``` 参数说明如下: - What:要查找的字符串。 - After:指定从哪个字符开始查找。如果不指定,则从字符串的第一个字符开始查找。 - LookIn:指定要查找的字符串类型。可选值为xlValues(查找单元格的内容)或xlFormulas(查找单元格的公式)。 - LookAt:指定查找方式。可选值为xlWhole(查找整个单元格的字符串)或xlPart(查找部分字符串)。 - SearchOrder:指定查找顺序。可选值为xlByRows(按行查找)或xlByColumns(按列查找)。 - SearchDirection:指定查找方向。可选值为xlNext(向下或向右查找)或xlPrevious(向上或向左查找)。 - MatchCase:指定是否区分大小写。可选值为True(区分大小写)或False(不区分大小写)。 - MatchByte:用于 Double-Byte Character Set (DBCS) 语言的可选参数。 - MatchWildcards:指定是否使用通配符。可选值为True(使用通配符)或False(不使用通配符)。 - MatchSoundsLike:用于 Double-Byte Character Set (DBCS) 语言的可选参数。 - MatchAllWordForms:指定是否匹配单词的所有形式。可选值为True(匹配所有形式)或False(只匹配指定形式)。 - Forward:指定查找方向是否为向前。可选值为True(向前)或False(向后)。 - Wrap:指定是否循环查找。可选值为True(循环查找)或False(不循环查找)。 使用FIND方法可以方便地在VBA查找指定字符串,并快速定位到该字符串所在的位置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值