reprovinci/satchmo.php-lib
Composer 安装命令:
composer require reprovinci/satchmo.php-lib
包简介
A helper library written in PHP for handling Satchmo form submissions.
README 文档
README
A helper library written in PHP for handling Satchmo form submissions.
Usage
<?php // Handles our upload. if ($_SERVER["REQUEST_METHOD"] === "POST") { try { # Create a new upload descriptor for our uploaded file. $upload = new Satchmo\Upload\ArrayUploadDescriptor($_FILES["file"]); # Create a new upload store, which temporarily stores the uploads in `data/`. $store = new Satchmo\Upload\SessionUploadStore("data"); # Store our upload in the store. `$key` can be used in subsequent to use the uploaded file. Don't forget to # `destroy()` the descriptor! $key = $store->store($upload); } catch (Exception $e) { # Gotta catch 'em all! # If no file was selected, an exception is sent to the browser. header("HTTP/1.1 500 Internal Server Error"); header("Content-Type: application/json"); print json_encode(array( "error" => get_class($e), "code" => $e->getCode(), "message" => $e->getMessage(), )); $response = Satchmo\HTTP\Response::createFromBuffer(500); $response->send(); exit(); } # Else, output our important information. header("Content-Type: application/json"); print json_encode(array( "data" => array( 42 => "So long and thanks for all the fish!", ) )); $response = Satchmo\HTTP\Response::createFromBuffer(); $response->send(); exit(); }
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-06-08