1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace console\controllers;
- use common\models\AdminLog;
- use common\models\Customer;
- use yii\console\Controller;
- use yii\data\ActiveDataProvider;
- class TestController extends Controller
- {
-
- public function actionIndex($message = 'hello world')
- {
- $customer = Customer::find()->all();
- $str = '';
- foreach($customer as $k => $v){
- $str .="BEGIN:VCARD
- VERSION:3.0
- PRODID:-//Apple Inc.//iOS 11.2.1//EN
- N:".$v->name.";;;;
- FN:".$v->name."
- item1.TEL;type=pref:".$v->tel."
- REV:2018-01-15T08:22:36Z
- END:VCARD
- \n";
- }
- $str = rtrim($str, ',');
-
-
- $myfile = fopen("newfile.vcf", "w") or die("Unable to open file!");
- fwrite($myfile, $str);
- fwrite($myfile, $str);
- fclose($myfile);
- die;
- }
- public function actionCreate() {
- echo 'advanced';
- }
- }
|