質問編集履歴

3

タイトル修正

2016/12/06 02:11

投稿

Kuriaki
Kuriaki

スコア85

test CHANGED
@@ -1 +1 @@
1
- 添付ファイルつきのメールの作り方てですが(エラーが出ている状態)
1
+ 作成されたcsvファイルをzipファイルにし,メールに添付して送信したい(エラーが出ている状態)
test CHANGED
File without changes

2

問題修正

2016/12/06 02:11

投稿

Kuriaki
Kuriaki

スコア85

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,71 @@
26
26
 
27
27
 
28
28
 
29
+ $zip = new ZipArchive();
30
+
31
+ // ZIPファイルを開く
32
+
33
+ $res = $zip->open('text.zip', ZipArchive::OVERWRITE);
34
+
35
+ // zipファイルが作れなかったら終了
36
+
37
+ if ($res !== true) {
38
+
39
+ echo "zipファイル作成失敗\n";
40
+
41
+ return;
42
+
43
+ }
44
+
45
+ // addFileでzipに追加するファイルを指定
46
+
47
+ $zip->addFile('text.csv');
48
+
49
+ $zip->close();
50
+
51
+ // ZIPファイルをクローズ
52
+
53
+ system('zip -P symfoware text.zip text.csv ');
54
+
55
+
56
+
57
+
58
+
59
+ $zip = new ZipArchive();
60
+
29
- $filepath = "text.zip";
61
+ $zip->open('text.zip');
62
+
63
+ //ここにエラーが出ています↓↓updating: text.csv (deflated 78%)
64
+
65
+ //Fatal error: Call to undefined method ZipArchive::setPassword() in /home/blotag/www/ryu/csv/send.php on line 53
66
+
67
+ $zip->setPassword('symfoware');
68
+
69
+ $im_string = $zip->getFromName("text.csv");
70
+
71
+ $im = imagecreatefromstring($im_string);
72
+
73
+ imagejpeg($im, 'text.csv');
74
+
75
+ system('unzip -P symfoware text.zip');
76
+
77
+
78
+
79
+ mb_language("Japanese");
80
+
81
+ mb_internal_encoding("UTF-8");
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ $filepath = "http://blotag.sakura.ne.jp/ryu/csv/text.zip";
30
94
 
31
95
  $boundary = "__BOUNDARY__";
32
96
 
@@ -34,7 +98,7 @@
34
98
 
35
99
  $additional_headers = "Content-Type: multipart/mixed;boundary=\"" . $boundary . "\"\n";
36
100
 
37
- $additional_headers .= "From:xxxxxx";
101
+ $additional_headers .= "From:xxxxxxx";
38
102
 
39
103
 
40
104
 
@@ -52,17 +116,13 @@
52
116
 
53
117
 
54
118
 
55
- //ここにエラーが出でます↓↓Warning: mime_content_type() [function.mime-content-type]: Can only process string or stream arguments in send.php on line 56
56
-
57
- $message .= "Content-Type: " . mime_content_type($filetype) . "; name=\"text.zip" . basename($filepath) . "\"\n";
119
+ $message .= "Content-Type: " . mime_content_type('text.zip') . "; name=\"text.zip" . basename($filepath) . "\"\n";
58
120
 
59
121
  $message .= "Content-Disposition: attachment; filename=\"text.zip" . basename($filepath) . "\"\n";
60
122
 
61
123
  $message .= "Content-Transfer-Encoding: base64\n";
62
124
 
63
125
  $message .= "\n";
64
-
65
- //ここにもです↓↓Warning: file_get_contents(http://blotag.sakura.ne.jp/ryu/csv/text.zip) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in send.php on line 60
66
126
 
67
127
  $message .= chunk_split(base64_encode(file_get_contents($filepath)))."\n";
68
128
 
@@ -76,9 +136,9 @@
76
136
 
77
137
 
78
138
 
79
- $to = "xxxxxx";
139
+ $to = "xxxx";
80
140
 
81
- $subject = "ハロー"
141
+ $subject = "ハロー";
82
142
 
83
143
  $send_mail = mb_send_mail($to, $subject, $message, $additional_headers);
84
144
 
@@ -92,4 +152,6 @@
92
152
 
93
153
  }
94
154
 
155
+
156
+
95
157
  ```

1

修正

2016/12/06 02:09

投稿

Kuriaki
Kuriaki

スコア85

test CHANGED
File without changes
test CHANGED
@@ -52,6 +52,8 @@
52
52
 
53
53
 
54
54
 
55
+ //ここにエラーが出でます↓↓Warning: mime_content_type() [function.mime-content-type]: Can only process string or stream arguments in send.php on line 56
56
+
55
57
  $message .= "Content-Type: " . mime_content_type($filetype) . "; name=\"text.zip" . basename($filepath) . "\"\n";
56
58
 
57
59
  $message .= "Content-Disposition: attachment; filename=\"text.zip" . basename($filepath) . "\"\n";
@@ -59,6 +61,8 @@
59
61
  $message .= "Content-Transfer-Encoding: base64\n";
60
62
 
61
63
  $message .= "\n";
64
+
65
+ //ここにもです↓↓Warning: file_get_contents(http://blotag.sakura.ne.jp/ryu/csv/text.zip) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in send.php on line 60
62
66
 
63
67
  $message .= chunk_split(base64_encode(file_get_contents($filepath)))."\n";
64
68
 
@@ -74,9 +78,7 @@
74
78
 
75
79
  $to = "xxxxxx";
76
80
 
77
- $subject = "ハロー"
81
+ $subject = "ハロー"
78
-
79
- //この行にパスエラーが出ています。↓↓↓エラー文はParse error: syntax error, unexpected T_VARIABLE in /home/略
80
82
 
81
83
  $send_mail = mb_send_mail($to, $subject, $message, $additional_headers);
82
84