当前位置: 首页>>代码示例>>PHP>>正文


PHP check_return_code函数代码示例

本文整理汇总了PHP中check_return_code函数的典型用法代码示例。如果您正苦于以下问题:PHP check_return_code函数的具体用法?PHP check_return_code怎么用?PHP check_return_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_return_code函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: error_reporting

error_reporting(NULL);
ob_start();
session_start();
include $_SERVER['DOCUMENT_ROOT'] . "/inc/main.php";
// Check token
if (!isset($_GET['token']) || $_SESSION['token'] != $_GET['token']) {
    header('location: /login/');
    exit;
}
// Check user
if ($_SESSION['user'] != 'admin') {
    header("Location: /list/user");
    exit;
}
if (!empty($_GET['user'])) {
    $user = $_GET['user'];
}
if (!empty($_GET['domain'])) {
    $v_username = escapeshellarg($user);
    $v_domain = escapeshellarg($_GET['domain']);
    exec(VESTA_CMD . "v-unsuspend-domain " . $v_username . " " . $v_domain, $output, $return_var);
}
check_return_code($return_var, $output);
unset($output);
$back = getenv("HTTP_REFERER");
if (!empty($back)) {
    header("Location: " . $back);
    exit;
}
header("Location: /list/web/");
exit;
开发者ID:DouglasDigital,项目名称:vesta,代码行数:31,代码来源:index.php

示例2: handle_file_upload

 protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
 {
     $file = new \stdClass();
     $file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
     $file->size = $this->fix_integer_overflow(intval($size));
     $file->type = $type;
     if ($this->validate($uploaded_file, $file, $error, $index)) {
         $this->handle_form_data($file, $index);
         $upload_dir = $this->get_upload_path();
         if (!is_dir($upload_dir)) {
             mkdir($upload_dir, $this->options['mkdir_mode'], true);
         }
         $file_path = $this->get_upload_path($file->name);
         $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
             } else {
                 chmod($uploaded_file, 0644);
                 //move_uploaded_file($uploaded_file, $file_path);
                 exec(VESTA_CMD . "v-copy-fs-file " . USERNAME . " {$uploaded_file} {$file_path}", $output, $return_var);
                 $error = check_return_code($return_var, $output);
                 if ($return_var != 0) {
                     //var_dump(VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}");
                     //var_dump($path);
                     //var_dump($output);
                     $file->error = 'Error while saving file';
                     /*var_dump(VESTA_CMD . "v-copy-fs-file ". USERNAME ." {$uploaded_file} {$file_path}");
                       var_dump($return_var);
                       var_dump($output);
                       die();*/
                 }
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         }
         $file_size = $this->get_file_size($file_path, $append_file);
         if ($file_size === $file->size) {
             $file->url = $this->get_download_url($file->name);
             // uncomment if images also need to be resized
             //if ($this->is_valid_image_file($file_path)) {
             //    $this->handle_image_file($file_path, $file);
             //}
         } else {
             //$file->size = $file_size;
             //if (!$content_range && $this->options['discard_aborted_uploads']) {
             //    unlink($file_path);
             //    $file->error = $this->get_error_message('abort');
             //}
         }
         $this->set_additional_file_properties($file);
     }
     return $file;
 }
开发者ID:lamvd0101,项目名称:vesta,代码行数:56,代码来源:UploadHandler.php


注:本文中的check_return_code函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。