いろいろ検索して、なんとなくコードを書いたのですが、パスエラーが出ています。何が問題でエラーでてるのかがわかりません。
教えていただけたら助かります!
そして、方法とうしてはあってるか間違ってるかもわからなくて、少しでもアドバイスやヒントをいただけないでしょうか
回答よろしくお願いいたします!
php
1 mb_language("Japanese"); 2 mb_internal_encoding("UTF-8"); 3 4 5 6 7 8$zip = new ZipArchive(); 9// ZIPファイルを開く 10$res = $zip->open('text.zip', ZipArchive::OVERWRITE); 11// zipファイルが作れなかったら終了 12if ($res !== true) { 13 echo "zipファイル作成失敗\n"; 14 return; 15} 16// addFileでzipに追加するファイルを指定 17$zip->addFile('text.csv'); 18$zip->close(); 19// ZIPファイルをクローズ 20system('zip -P symfoware text.zip text.csv '); 21 22 23$zip = new ZipArchive(); 24$zip->open('text.zip'); 25//ここにエラーが出ています↓↓updating: text.csv (deflated 78%) 26//Fatal error: Call to undefined method ZipArchive::setPassword() in /home/blotag/www/ryu/csv/send.php on line 53 27$zip->setPassword('symfoware'); 28$im_string = $zip->getFromName("text.csv"); 29$im = imagecreatefromstring($im_string); 30imagejpeg($im, 'text.csv'); 31system('unzip -P symfoware text.zip'); 32 33 mb_language("Japanese"); 34 mb_internal_encoding("UTF-8"); 35 36 37 38 39 40$filepath = "http://blotag.sakura.ne.jp/ryu/csv/text.zip"; 41$boundary = "__BOUNDARY__"; 42 43$additional_headers = "Content-Type: multipart/mixed;boundary=\"" . $boundary . "\"\n"; 44$additional_headers .= "From:xxxxxxx"; 45 46$message = "--" . $boundary . "\n"; 47 48$message .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n\n"; 49$message .= $moji."\n"; 50 51$message .= "--" . $boundary . "\n"; 52 53$message .= "Content-Type: " . mime_content_type('text.zip') . "; name=\"text.zip" . basename($filepath) . "\"\n"; 54$message .= "Content-Disposition: attachment; filename=\"text.zip" . basename($filepath) . "\"\n"; 55$message .= "Content-Transfer-Encoding: base64\n"; 56$message .= "\n"; 57$message .= chunk_split(base64_encode(file_get_contents($filepath)))."\n"; 58 59$message .= "--" . $boundary . "--"; 60 61 62 63$to = "xxxx"; 64$subject = "ハロー"; 65$send_mail = mb_send_mail($to, $subject, $message, $additional_headers); 66 if ( $send_mail ) { 67 echo "送信完了"; 68 }else { 69 echo "メールを送信できませんでした。"; 70 } 71
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/06 01:23