質問編集履歴
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -127,3 +127,15 @@
|
|
127
127
|
をcontorollerやviewに書いても通らない。
|
128
128
|
|
129
129
|
Error: Class 'App\Controller\PHPExcel_IOFactory' not found
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
###追記
|
136
|
+
|
137
|
+
Error: Class 'App\Controller\PHPExcel_IOFactory' not found
|
138
|
+
|
139
|
+
↓
|
140
|
+
|
141
|
+
完全修飾名を付けて対応。
|
3
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,13 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
0.
|
15
|
+
0. composerでインストール
|
16
16
|
|
17
|
-
vendor\phpexcel\PHPExcel
|
17
|
+
vendor\phpoffice\phpexcel\Classes\PHPExcel.php
|
18
18
|
|
19
|
-
vendor\phpexcel\PHPExcel
|
19
|
+
vendor\phpoffice\phpexcel\Classes\PHPExcel
|
20
|
+
|
21
|
+
がパス。
|
20
22
|
|
21
23
|
|
22
24
|
|
@@ -46,11 +48,19 @@
|
|
46
48
|
|
47
49
|
```PHP
|
48
50
|
|
51
|
+
<?php
|
52
|
+
|
53
|
+
namespace App\Controller;
|
54
|
+
|
55
|
+
use App\Controller\AppController;
|
56
|
+
|
57
|
+
use PHPExcel;
|
58
|
+
|
59
|
+
|
60
|
+
|
49
61
|
public function insert()
|
50
62
|
|
51
63
|
{
|
52
|
-
|
53
|
-
//ここにユーザチェックのスクリプト。管理者じゃなければリダイレクト。ここはわかります。
|
54
64
|
|
55
65
|
|
56
66
|
|
@@ -58,11 +68,11 @@
|
|
58
68
|
|
59
69
|
if ($this->request->is('post')) {
|
60
70
|
|
71
|
+
$readfile = $this->request->data['excelfile']['tmp_name'];
|
72
|
+
|
61
|
-
|
73
|
+
$objPHPExcel = PHPExcel_IOFactory::load($readFile);
|
62
74
|
|
63
75
|
|
64
|
-
|
65
|
-
//チェックがエラーでなければデータベースを空にして挿入
|
66
76
|
|
67
77
|
}
|
68
78
|
|
@@ -110,18 +120,10 @@
|
|
110
120
|
|
111
121
|
###問題となっていること。
|
112
122
|
|
113
|
-
|
123
|
+
PHPExcelが読み込めない。
|
114
|
-
|
115
|
-
App::import('Vendor', 'PHPExcel', array('file' => 'phpexcel' . DS . 'PHPExcel.php'));
|
116
|
-
|
117
|
-
App::import('Vendor', 'PHPExcel_IOFactory', array('file'=>'phpexcel'. DS .'PHPExcel'. DS .'IOFactory.php'));
|
118
|
-
|
119
|
-
App::import('Vendor', 'PHPExcel_Cell_AdvancedValueBinder', array('file'=>'phpexcel'. DS .'PHPExcel'. DS .'Cell'. DS .'AdvancedValueBinder.php'));
|
120
|
-
|
121
|
-
```
|
122
124
|
|
123
125
|
|
124
126
|
|
125
127
|
をcontorollerやviewに書いても通らない。
|
126
128
|
|
127
|
-
Error: Class 'App\Controller\
|
129
|
+
Error: Class 'App\Controller\PHPExcel_IOFactory' not found
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
挿入時に、データベースにある情報を一度空にして、再度Excelファイル(xlsx拡張子とxls拡張子)の情報を挿入したいと考えています。
|
5
|
+
挿入時に、データベースにある情報を一度空にして、再度Excelファイル(xlsx拡張子とxls拡張子)の情報を挿入したいと考えています。csvも考えましたが、データの中に,が出てくるためPHPEXCELを使うことにしました。
|
6
6
|
|
7
|
-
|
7
|
+
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -108,4 +108,20 @@
|
|
108
108
|
|
109
109
|
|
110
110
|
|
111
|
+
###問題となっていること。
|
112
|
+
|
113
|
+
```PHP
|
114
|
+
|
115
|
+
App::import('Vendor', 'PHPExcel', array('file' => 'phpexcel' . DS . 'PHPExcel.php'));
|
116
|
+
|
117
|
+
App::import('Vendor', 'PHPExcel_IOFactory', array('file'=>'phpexcel'. DS .'PHPExcel'. DS .'IOFactory.php'));
|
118
|
+
|
119
|
+
App::import('Vendor', 'PHPExcel_Cell_AdvancedValueBinder', array('file'=>'phpexcel'. DS .'PHPExcel'. DS .'Cell'. DS .'AdvancedValueBinder.php'));
|
120
|
+
|
121
|
+
```
|
122
|
+
|
123
|
+
|
124
|
+
|
111
|
-
|
125
|
+
をcontorollerやviewに書いても通らない。
|
126
|
+
|
127
|
+
Error: Class 'App\Controller\App' not found と出る。
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -49,6 +49,10 @@
|
|
49
49
|
public function insert()
|
50
50
|
|
51
51
|
{
|
52
|
+
|
53
|
+
//ここにユーザチェックのスクリプト。管理者じゃなければリダイレクト。ここはわかります。
|
54
|
+
|
55
|
+
|
52
56
|
|
53
57
|
$list = $this->Lists->newEntity();
|
54
58
|
|