首页
开发手册
应用中心
工具
用户中心
Ease Template File Read and Write
English
中文简体
English
上一篇
下一篇
### Ease Template File Read and Write In order to facilitate the reading and writing of files during development, Ease Template provides a simple method that only requires simple operations. #### > Get folder $tpl->get_dir(Directory address, display type) ``` //display the files in the data directory $tpl->get_dir('/data',1); ``` directory address:`you can fill in absolute address or relative address` display type:`0 gets the folder, 1 gets the file` ------------ #### > Folder Creation $tpl->mk_dir(directory address, directory permissions) ``` //create an et folder in the data directory $tpl->mk_dir('/data/et',0755); ``` directory address:`You can fill in absolute address or relative address` directory permissions:`0777 fully writable, 0755 writable permission, 0644 read-only permission` ------------ #### > Folder Deletion $tpl->del_dir(directory address, delete operation) ``` //delete the et folder in the data directory $tpl->del_dir('/data/et',0); ``` directory address:`You can fill in absolute address or relative address` delete operation:`1 means delete data in the directory, 0 deletes this directory by default` ------------ #### > Read File $tpl->reader(file name) ``` //Read file address $tpl->reader('/data/et.htm'); ``` directory address:`The directory and file name can be read by filling in, and it will fail if there is no file.` ------------ #### > Write File $tpl->writer(File name, write data, write method) ``` //delete the et folder in the data directory $tpl->writer('/data/et.htm','Ease Template!'); ``` directory address:`You can fill in absolute address or relative address` data input:`Data content, the array needs to be written after json` write method: | Mode | Description | | ------------ | ------------ | |r|In read-only mode, the file pointer points to the file header.| |r+|In read and write mode, the file pointer points to the file header.| |w|In writing mode, the file pointer points to the head of the file and the file is cleared.| |w+|In read and write mode, the file pointer points to the head of the file and the file is cleared.| |a|In writing mode, the file pointer points to the end of the file.| |a+|Read and write mode, the file pointer points to the end of the file Description.