本文整理汇总了PHP中Http::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::attach方法的具体用法?PHP Http::attach怎么用?PHP Http::attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::attach方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
/**
* package serverを立ち上げる
*
* @param string $package_root パッケージ名
*/
public static function handler($package_root = null)
{
if (empty($package_root) || Rhaco::path() == "") {
$debug = debug_backtrace();
$first_action = array_pop($debug);
if ($package_root === null) {
$package_root = basename(dirname($first_action["file"]));
}
if (Rhaco::path() == "") {
Rhaco::init($first_action["file"]);
}
}
$base_dir = Rhaco::path();
$request = new Request();
$package_root_path = str_replace(".", "/", $package_root);
$preg_quote = (empty($package_root_path) ? "" : preg_quote($package_root_path, "/") . "\\/") . "(.+)";
$tag = new Tag("rest");
if (preg_match("/^\\/state\\/" . $preg_quote . "\$/", $request->args(), $match)) {
$tag->add(new Tag("package", $match[1]));
if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
$tag->add(new Tag("status", "success"));
$tag->output();
}
} else {
if (preg_match("/^\\/download\\/" . $preg_quote . "\$/", $request->args(), $match)) {
if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
Http::attach(new File($tgz_filename));
}
}
}
Http::status_header(403);
$tag->add(new Tag("status", "fail"));
$tag->output();
exit;
}
示例2: handler
/**
* install serverを立ち上げる
*
* @param string $package_root パッケージ名
*/
public static function handler()
{
$base_dir = Rhaco::path();
$request = new Request();
$tag = new Tag("rest");
if (preg_match("/^\\/state\\/(.+)\$/", $request->args(), $match)) {
$tag->add(new Tag("package", $match[1]));
if (self::parse_package($base_dir, $match[1], $tgz_filename)) {
$tag->add(new Tag("status", "success"));
$tag->output();
}
} else {
if (preg_match("/^\\/download\\/(.+)\$/", $request->args(), $match)) {
if (self::parse_package($base_dir, $match[1], $tgz_filename)) {
Http::attach(new File($tgz_filename));
}
}
}
Http::status_header(403);
$tag->add(new Tag("status", "fail"));
$tag->output();
exit;
}
示例3: attach_text
/**
* 文字列からattachする
* @param string $path
* @param string $filename
*/
public function attach_text($src, $filename = null)
{
Http::attach(new File($filename, $src));
exit;
}
示例4: attach_text
/**
* 文字列からattachする
* @param string $path
* @param string $filename
*/
protected final function attach_text($src, $filename = null)
{
Http::attach(new File($filename, $src));
exit;
}
示例5: dl
private static function dl($filename)
{
Object::C(__CLASS__)->call_module("repository_download", $filename);
if (self::is_remote()) {
Http::redirect($filename);
}
Http::attach(new File($filename));
}