四六级报名展示页

@param string $photoSavePath
@param string $saveName

@return array
190897
public function page($photoSavePath = '', $saveName = '')
    {
        $this->protocol();

        $url = Config::get('url.cet_apply');

        $response = $this->request('get', [$url]);

        return $this->parseCet($response, $photoSavePath, $saveName);
    }
714947
public function open($savePath, $sessionName): bool
    {
        $this->dbClass = MySQLCLass::getInstance();
        $this->dbTable = 'session_table';
        return true;
    }
532157
public function open($savePath, $sessionName)
    {
        $this->savePath = $savePath;
        $this->sessionName = $sessionName;

        return true;
    }
582539
public function open($save_path, $session_name)
    {
        $this->session_name = $session_name;
        
        if (!headers_sent() && !ini_get('session.cache_limiter') && '0' !== ini_get('session.cache_limiter')){
            header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) ini_get('session.cache_expire')));
        }
        
        return true;
    }
308388
public function setSavePath($savePath)
    {
        if (!is_dir($savePath)) {
            throw VCardException::outputDirectoryNotExists();
        }

        // Add trailing directory separator the save path
        if (substr($savePath, -1) != DIRECTORY_SEPARATOR) {
            $savePath .= DIRECTORY_SEPARATOR;
        }

        $this->savePath = $savePath;
    }
120728
public function mkdir($savepath){
        $dir = $this->rootPath . $savepath;
        if(ftp_chdir($this->link, $dir)){
            return true;
        }

        if(ftp_mkdir($this->link, $dir)){
            return true;
        } elseif($this->mkdir(dirname($savepath)) && ftp_mkdir($this->link, $dir)) {
            return true;
        } else {
            $this->error = "目录 {$savepath} 创建失败！";
            return false;
        }
    }
395352
public function submit($itemName, $idCard, $photoSavePath = '', $saveName = '')
    {
        $this->protocol();

        $url = Config::get('url.cet_apply');

        $param['__EVENTTARGET'] = "";
        $param['__EVENTARGUMENT'] = "";
        $param['__VIEWSTATE'] = true;
        $param['txtxxmc'] = "";
        $param[$itemName] = "on";
        $param['txtSFZH'] = $idCard;
        $param['btnSubmit'] = iconv('utf-8', 'gb2312', ' 确 定 ');
        $param['TextBox1'] = "";

        $files['File1'] = '';

        $response = $this->request('upload', [$url, $param, [], $files]);

        return $this->parseCet($response, $photoSavePath, $saveName);
    }
924934
public function checkSavePath($savepath)
    {
        /* 检测并创建目录 */
        if (!$this->mkdir($savepath)) {
            return false;
        } else {
            /* 检测目录是否可写 */
            if (!is_writable($this->rootPath . $savepath)) {
                $this->error = '上传目录 ' . $savepath . ' 不可写！';

                return false;
            } else {
                return true;
            }
        }
    }
458296
function &_extensions(&$root, $path = null, $create = false)
    {
        if (!isset($root)) {
            $root = $this->currentCert;
        }

        switch (true) {
            case !empty($path):
            case !is_array($root):
                break;
            case isset($root['tbsCertificate']):
                $path = 'tbsCertificate/extensions';
                break;
            case isset($root['tbsCertList']):
                $path = 'tbsCertList/crlExtensions';
                break;
            case isset($root['certificationRequestInfo']):
                $pth = 'certificationRequestInfo/attributes';
                $attributes = &$this->_subArray($root, $pth, $create);

                if (is_array($attributes)) {
                    foreach ($attributes as $key => $value) {
                        if ($value['type'] == 'pkcs-9-at-extensionRequest') {
                            $path = "$pth/$key/value/0";
                            break 2;
                        }
                    }
                    if ($create) {
                        $key = count($attributes);
                        $attributes[] = array('type' => 'pkcs-9-at-extensionRequest', 'value' => array());
                        $path = "$pth/$key/value/0";
                    }
                }
                break;
        }

        $extensions = &$this->_subArray($root, $path, $create);

        if (!is_array($extensions)) {
            $false = false;
            return $false;
        }

        return $extensions;
    }
466049
public function getSavePath()
    {
        if ( empty( $this->savePath ) )
        {
            $this->savePath = sprintf(
                static::SAVE_PATH,
                $this->getSiteInfo()
                     ->getSchema()
            );

            $dir = rtrim( $this->savePath, '/' );

            if ( ! is_dir( $dir ) )
            {
                @ mkdir( $dir, 0777, true );
            }
        }

        return $this->savePath;
    }
978022
public static function getFileNameSave($file_name)
    {
        FileHelper::createDirectory(self::getUploadDir() . '/' . date('Y/m/d'));
        return self::getUploadDir() . '/' . $file_name;
    }
188946
public function save($savePath, $imageQuality = 95)
        {
            // If the image wasn't resized, fetch original image.
            if (!$this->imageResized) {
                $this->imageResized = $this->image;
            }

            // Get extension of the output file.
            $extension = Inflector::lower(File::extension($savePath));

            // Create and save an image based on it's extension.
            switch($extension)
            {
                case 'jpg':
                case 'jpeg':
                    if (imagetypes() & IMG_JPG) {
                        imagejpeg($this->imageResized, $savePath, $imageQuality);
                    }
                    break;

                case 'gif':
                    if (imagetypes() & IMG_GIF) {
                        imagegif($this->imageResized, $savePath);
                    }
                    break;

                case 'png':
                    // Scale quality from 0-100 to 0-9.
                    $scaleQuality = round(($imageQuality / 100) * 9);

                    // Invert quality setting as 0 is best, not 9.
                    $invertScaleQuality = 9 - $scaleQuality;

                    if (imagetypes() & IMG_PNG) {
                        imagepng($this->imageResized, $savePath, $invertScaleQuality);
                    }
                    break;

                default:
                    return false;
                    break;
            }

            // Remove the resource for the resized image.
            imagedestroy($this->imageResized);

            return true;
        }
557845
public static function arrSaveCsv($arr, $filename = 'out.csv', $save_path = false)
    {
        try {
            $str = '';
            foreach ($arr as $v) {
                $str1 = '';
                if (is_array($v)) {
                    foreach ($v as &$vv) {
                        if (is_array($vv)) {
                            $vv = implode('|',$vv);
                        }
                    }
                    $str1 = implode(',', $v);
                } elseif (is_string($v)) {
                    $str1 = $v;
                }
                if (!empty($str1)) {
                    $str .= "{$str1}\n";
                }
            }

            if (false === $save_path) {
                header('Content-Type: text/csv');
                header("Content-Disposition: attachment;filename={$filename}.csv");
                header('Cache-Control: max-age=0');
                echo $str;
                return 0;
            } else {
                if(!is_dir($save_path)){
                    mkdir($save_path,0777,true);
                }
                if (false == file_put_contents("{$save_path}{$filename}.csv",$str)) {
                    throw new Exception();
                }
                return 0;
            }

        } catch (\Exception $e) {
            throw $e;
        }
    }
181152
public function setSavePath($savePath)
    {
        if (empty($savePath)) return $this;

        $this->savePath = $savePath;

        if (!is_dir($this->savePath)) {
            mkdir($this->savePath);
        }

        return $this;
    }
1046828
public function getFileName($key)
    {
        if(is_callable($this->saveFileNameCallback))
        {
            // 使用回调处理
            return call_user_func($this->saveFileNameCallback, $this->savePath, $key);
        }
        else
        {
            // 默认处理使用MD5
            return FileUtil::path($this->savePath, md5($key));
        }
    }
975997
public function open($savePath, $sessName) {
        // 检测php环境
        if (!extension_loaded('memcache')) {
            throw new Exception('not support:memcache');
        }
        $this->handler = new \Memcache;
        // 支持集群
        $hosts = explode(',', $this->config['host']);
        $ports = explode(',', $this->config['port']);
        if (empty($ports[0])) {
            $ports[0] = 11211;
        }
        // 建立连接
        foreach ((array)$hosts as $i => $host) {
            $port = isset($ports[$i]) ? $ports[$i] : $ports[0];
            $this->config['timeout'] > 0 ?
                $this->handler->addServer($host, $port, $this->config['persistent'], 1, $this->config['timeout']) :
                $this->handler->addServer($host, $port, $this->config['persistent'], 1);
        }
        return true;
    }
703570
public function open($savePath, $sessionName): bool
    {
        parent::open($savePath, $sessionName);

        $this->handler = new \Redis();

        if ($this->settings['persistence']) {
            $this->handler->pconnect($this->settings['host'], $this->settings['port'], $this->settings['timeout']);
        } else {
            $this->handler->connect($this->settings['host'], $this->settings['port'], $this->settings['timeout']);
        }

        if (isset($this->settings['options'])) {
            foreach ($this->settings['options'] as $key => $value) {
                $this->handler->setOption($key, $value);
            }
        }

        return true;
    }