PHP与ThinkPHP读写文件

  1. 使用php将数据写入到指定的文件
      $str="<?php return".var_export($phiz,true)."?>";
      file_put_contents('./Data/phiz.php');
        php

  2. 使用php读取指定的文件                                                                                 $phiz=include './Data/phiz.php';                                                                                     或者:$phiz=file_get_contents($phiz);                                                                                 dump($phiz);get

  3. 使用tp的方法将数据写入到指定的文件   
      F('phiz',$phiz,'./Data/');file

    4.  使用tp的方法将指定文件的读取出来
         $phiz=F('phiz','','./Data/');方法

相关文章
相关标签/搜索