fetch

Attribute Name

Type

Required

Default

Description

file

string

Yes

n/a

the file, http or ftp site to fetch

assign

string

No

n/a

the template variable the output will be assigned

to

属性

类型

是否必须

缺省值

描述

file

string

Yes

n/a

待请求的文件,http或ftp方式.

assign

string

No

n/a

输出值将被赋给模板变量的名称

fetch is used to fetch files from the local file system, http, or ftp and display

the contents. If the file name begins with "http://", the web site page will

be fetched and displayed. If the file name begins with "ftp://", the file

will be fetched from the ftp server and displayed. For local files, the full

system file path must be given, or a path relative to the executed php script.

fetch 用于从本地文件系统、HTTP或FTP上取得文件并显示文件的内容. 如果文件名称以"http://"开头,将取得该网站页面并显示.

如果文件名称以"ftp://"开头,将从ftp服务器取得该文件并显示.

If you supply the special "assign" attribute, the output of the fetch function

will be assigned to this template variable instead of being output to the

template. (new in Smarty 1.5.0)

如果指定了 "assign" 这个特殊属性,该函数的输出值将被赋给由 assign 指定的模板变量,而不是直接输出.(Smarty 版本

1.5.0 新特性)

Technical Note: This will not support http redirects, be sure to include a trailing slash on

your web page fetches where necessary.

技术要点: 该函数不支持HTTP重定向,如果要取得web默认页,比如想取得www.domain.com的主页资料,但是不知道主页的具体名称,可能是index.php或index.htm或default.php等等,可以直接使用该站点的url,记得在url结尾处加上反斜线.

Technical Note: If template security is turned on and you are fetching a file from the local

file system, this will only allow files from within one of the defined

secure directories. ($secure_dir)

技术要点: 如果模板的安全设置打开了,当取本地文件时只能取位于定义为安全文件夹下的资料. ($secure_dir)

Example 8-5. fetch

例 8-5. fetch 函数演示

{* include some javascript in your template *}

{fetch file="/export/httpd/www.domain.com/docs/navbar.js"}

{* embed some weather text in your template from another web site *}

{fetch file="http://www.myweather.com/68502/"}

{* fetch a news headline file via ftp *}

{fetch file="ftp://user:password@ftp.domain.com/path/to/currentheadlines.txt"}

{* assign the fetched contents to a template variable *}

{fetch file="http://www.myweather.com/68502/" assign="weather"}

{if $weather ne ""}

{$weather}

{/if}

php smarty fetch,fetch - [ smarty完全中文手册 ] - 在线原生手册 - php中文网相关推荐

  1. php recordarray,Array 数组 - [ php中文手册 ] - 在线原生手册 - php中文网

    用户评论: [#1] florenxe [2015-10-07 18:53:45] //a nice little way to print leap years using array for ($ ...

  2. php gridview,GridView - [ Android中文手册 ] - 在线原生手册 - php中文网

    GridView 版本:Android 2.2 r1 public final class GridView extendsAbsListView java.lang.Object android.v ...

  3. c语言fsetpos是什么,fsetpos - [ C语言中文开发手册 ] - 在线原生手册 - php中文网

    在头文件中定义int fsetpos(FILE * stream,const fpos_t * pos); stream根据指向的值设置文件流的文件位置指示符和多字节解析状态(如果有)pos. 除了建 ...

  4. c语言中mw shl code,cacoshl - [ C语言中文开发手册 ] - 在线原生手册 - php中文网

    在头文件中定义float complex       cacoshf( float complex z );(1)(since C99) double complex      cacosh( dou ...

  5. php vprintf,vprintf - [ C语言中文开发手册 ] - 在线原生手册 - php中文网

    格式-指向以空字符结尾的字符串的指针,指定如何解释数据.格式字符串由普通的多字节字符(%除外)组成,它们被原样复制到输出流和转换规范中.每个转换规范具有以下格式:介绍%字符(可选)一个或多个标志,用于 ...

  6. cbrt c语音_isgraph - [ C语言中文开发手册 ] - 在线原生手册 - php中文网

    在头文件中定义int isgraph(int ch); 检查给定字符是否具有图形表示形式,即它是数字(0123456789),大写字母(ABCDEFGHIJKLMNOPQRSTUVWXYZ),小写字母 ...

  7. c语言L文件,frexpl - [ C语言中文开发手册 ] - 在线原生手册 - php中文网

    在头文件中定义float frexpf(float arg,int * exp);(1)(自C99以来) double frexp(double arg,int * exp);(2) long dou ...

  8. android gravity参数,Gravity - [ Android中文手册 ] - 在线原生手册 - php中文网

    Gravity 版本:Android 4.0 r1 结构 继承关系 public class Gravity extends Object java.lang.Object android.view. ...

  9. php @touch,touch - [ php中文手册 ] - 在线原生手册 - php中文网

    用户评论: [#1] csouth at xistins dot com [2014-12-14 08:41:04] An earlier comment referenced a code snip ...

  10. php gui中文手册,git gui - [ Git中文开发手册 ] - 在线原生手册 - php中文网

    名称 git-gui  -  Git 的便携式图形界面 概要 git gui [] [arguments] 描述 基于 Tcl / Tk 的 Git 图形用户界面.git gui侧重于允许用户通过新的 ...

最新文章

  1. 我的RHCA之路随想
  2. rabbitmq启动方式
  3. linux系统之centos/ubuntu选择
  4. 好看的论文千篇一律,有趣的Github项目万里挑一!
  5. iTextSharp应用,生成pdf
  6. Java 8 Friday:Java 8将彻底改变数据库访问
  7. 方法的重载(overload)和重写(override)的区别
  8. Pocket英语语法---三、英语动词的特点是什么
  9. 一位AI研究员+区块链创业者的终极展望:AI DAO将统治世界
  10. 保温杯都这么给力了,你的 Bug 就不能少点?
  11. Linux文件的三个时间概念
  12. 【转】关于VS2005中不显示解决方案的解决方法
  13. thinkcmf 配置初始化加载模版
  14. ie选项 由于该计算机受到限制 本次操作已被取消,IE“Internet 选项”无法打开提示“由于该计算机受到限制本次操作已被取消”...
  15. Laravel 路由知识回顾记录 转自laravel 学院Laravel5.8
  16. Frequency domain enhancement
  17. 求生之路2服务器管理员权限设置[转]
  18. FireFox必备插件(七)
  19. 移动端使用PhotoSwipe 图片放大浏览
  20. Spring boot Shiro 用户认证

热门文章

  1. 记录一下:调试了虹软的人脸识别sdk,存到数据库中
  2. 李秋豪计算机系统,CS:APP3e 深入理解计算机系统_3e Y86-64模拟器指南
  3. jsoup爬虫实战详解之新浪
  4. html中火星文字体样式,火星文对照表
  5. NSGA2算法中文版详细介绍
  6. Linux网络命令之 `Hping3`
  7. PLSQL 1207 64位 配置
  8. markdown模板(个人使用)
  9. Itext 7 生成PDF总结
  10. echarts中geoCoordMap世界地图国家及中国城市的经纬度数组整理