定制 reprovinci/satchmo.php-lib 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 2
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固