public function extractData() { $gifts = Gift::all(); //礼品 $topics = Topic::all(); // 话题 $gift_posters = GiftPoster::all(); //礼品海报 $gift_photo_intros = GiftPhotoIntro::all(); //图文介绍 // fwrite(fopen(app_path().'\storage\mysq.txt', 'w'), 'man'); file_put_contents(app_path() . '/storage/gifts.txt', json_encode($gifts)); file_put_contents(app_path() . '/storage/topics.txt', json_encode($topics)); file_put_contents(app_path() . '/storage/gift_posters.txt', json_encode($gift_posters)); file_put_contents(app_path() . '/storage/gift_photo_intros.txt', json_encode($gift_photo_intros)); return 0; }