日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

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

發布時間:2023/12/14 php 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php smarty fetch,fetch - [ smarty完全中文手册 ] - 在线原生手册 - php中文网 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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中文网的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。