frdl / mime-stub
此脚本可用于生成可执行 .php 文件。
v1.2.0
2022-08-26 14:41 UTC
Requires
- php: >=5.3
Provides
README
webfan\MimeStubAPC
- 在 http://www.webfan.de/install/ 下载示例实现
- 示例
- 当前版本
<?php $vm = \webfan\MimeStubAPC::vm(); // echo print_r($vm, true); $newFile = __DIR__. DIRECTORY_SEPARATOR . 'TestMimeStubAPC.php'; $a = <<<PHPE echo ' TEST-modified.'; PHPE; $stub = $vm->get_file($vm->document, '$HOME/index.php', 'stub index.php') // ->clear() ->append($a) ; $vm->to('hello@wor.ld'); $vm->from('me@localhost'); $stub->from('hello@wor.ld'); $vm->location = $newFile; require $newFile; $run($newFile);
Riverline\MultiPartParser
什么是 Riverline\MultiPartParser
Riverline\MultiPartParse
是一个用于解析多部分文档(多部分电子邮件、多部分表单等)并管理每个部分的编码和字符集以提取其内容的单类库。
需求
- PHP 5.3 或 HHVM
安装
Riverline\MultiPartParse
与 composer 和任何 prs-0 自动加载器兼容。
composer require riverline/multipart-parser
用法
<?php use Riverline\MultiPartParser\Part; $content = <<<EOL User-Agent: curl/7.21.2 (x86_64-apple-darwin) Host: localhost:8080 Accept: */* Content-Type: multipart/form-data; boundary=----------------------------83ff53821b7c ------------------------------83ff53821b7c Content-Disposition: form-data; name="foo" bar ------------------------------83ff53821b7c Content-Transfer-Encoding: base64 YmFzZTY0 ------------------------------83ff53821b7c Content-Disposition: form-data; name="upload"; filename="text.txt" Content-Type: text/plain File content ------------------------------83ff53821b7c-- EOL; $document = new Part($content); if ($document->isMultiPart()) { $parts = $document->getParts(); echo $parts[0]->getBody(); // Output bar // It decode encoded content echo $parts[1]->getBody(); // Output base64 // You can also filter by part name $parts = $document->getPartsByName('foo'); echo $parts[0]->getName(); // Output foo // You can extract the headers $contentDisposition = $parts[0]->getHeader('Content-Disposition'); echo $contentDisposition; // Output Content-Disposition: form-data; name="foo" // Helpers echo Part::getHeaderValue($contentDisposition); // Output form-data echo Part::getHeaderOption($contentDisposition, 'name'); // Output foo // File helper if ($parts[2]->isFile()) { echo $parts[2]->getFileName(); // Output text.txt echo $parts[2]->getMimeType(); // Output text/plain } }