fetch function

fetch function

If the file name starts with "http://", the website page will be fetched and displayed. If the file name starts with Starting with "ftp://", the file will be obtained from the ftp server and displayed.

If "assign" is specified, this special Attribute, the output value of this function will be assigned to the template variable specified by assign instead of being output directly. (Smarty version 1.5.0 New features)

Technical points: This function does not support HTTP redirection. If you want to get the default web page, for example, you want to get the homepage information of www.domain.com, but you don’t know the homepage. The specific name may be index.php or index.htm or default.php, etc. You can directly use the URL of the site. Remember to add a backslash at the end of the URL.

## Technical points: If the security settings of the template are turned on, when retrieving local files, only data located in a folder defined as a safe folder can be retrieved. ($secure_dir)

eg:

{fetch file="https://www.baidu.com/"}

Output:

微信图片_20180313113800.png

Continuing Learning
||
<?php echo "fetch函数";
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!