<?php namespace Phpcmf\Controllers;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class Test extends \Phpcmf\Common
{
public function index() {
$objRead = IOFactory::createReader('Xlsx');
var_dump($objRead);
}
}
隨便哪個目錄都行,自己開發(fā)隨便放
看個人習(xí)慣,放在根目錄吧,/mycode/
回復(fù)@曹海峰
放根目錄的話,這個 use 路徑 是要這么寫嗎?? use mycode\php\
...php基礎(chǔ)知識啊,放哪個文件都行,require進(jìn)來直接use或者new
http://m.223987.com/doc/729.html
可以使用Composer,也可以自己建目錄,自己引入
http://m.223987.com/doc/767.html
框架可以自動加載直接new
第三方php類可以用這個 比如phpexcel的Composer類
回復(fù)@農(nóng)民大伯
樓主把關(guān)鍵部分打了馬賽克,不知道是自己寫的類還是第三方現(xiàn)成的類
回復(fù)@天天向上
第三方現(xiàn)成類啊!哥哥!
首先要引入類文件,然后再use
3#樓的方法可以,config/auto.php,具體什么第三方類知道的話我就可以直接給你寫出來
回復(fù)@易學(xué)習(xí)
等你這句話好久了,因為我是直接GIT下載,沒有AUTO文件
這個USE 是 PhpSpreadsheet組件
用框架的自動加載教程
PhpSpreadsheet包放在插件目錄里面
建dayrui\App\Demo\Config\Auto.php
鍵\dayrui\App\Demo\Controllers\Test.php
/index.php?s=demo&c=test
這個方法是最快捷的,引入方法很多看個人習(xí)慣了
回復(fù)@易學(xué)習(xí)
謝了。回頭測試一下
哪個目錄都行
隨心所欲啊。@易學(xué)習(xí) 的方法不錯
看看大佬
記錄一下,學(xué)習(xí)用
九樓牛逼