當前位置: 首頁>>代碼示例>>PHP>>正文


PHP unserialize函數代碼示例

本文整理匯總了PHP中unserialize函數的典型用法代碼示例。如果您正苦於以下問題:PHP unserialize函數的具體用法?PHP unserialize怎麽用?PHP unserialize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了unserialize函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: indexAction

 /**
  * Reference purchase summary
  *
  * @Route()
  * @Method({"GET", "POST"})
  * @Template()
  *
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction(Request $request)
 {
     $previouslyPostedData = null;
     // if we are not posting new data, and a request for $this->formType is stored in the session, prepopulate the form with the stored request
     $storedRequest = unserialize($request->getSession()->get($this->formType->getName()));
     if ($request->isMethod('GET') && $storedRequest instanceof Request) {
         $previouslyPostedData = $this->createForm($this->formType)->handleRequest($storedRequest)->getData();
     }
     $form = $this->createForm($this->formType, $previouslyPostedData);
     if ($request->isMethod('POST')) {
         $form->submit($request);
         if ($form->isValid()) {
             // Persist the case to IRIS
             /** @var ReferencingCase $case */
             $case = $form->getData()['case'];
             $this->irisEntityManager->persist($case);
             /** @var ReferencingApplication $application */
             foreach ($case->getApplications() as $application) {
                 // Always default
                 $application->setSignaturePreference(SignaturePreference::SCAN_DECLARATION);
                 $this->irisEntityManager->persist($application, array('caseId' => $case->getCaseId()));
                 // Persist each guarantor of the application
                 if (null !== $application->getGuarantors()) {
                     foreach ($application->getGuarantors() as $guarantor) {
                         $this->irisEntityManager->persist($guarantor, array('applicationId' => $application->getApplicationId()));
                     }
                 }
             }
             $request->getSession()->set('submitted-case', serialize($case));
             // Send the user to the success page
             return $this->redirect($this->generateUrl('barbon_hostedapi_agent_reference_newreference_tenancyagreement_index'), 301);
         }
     }
     return array('form' => $form->createView());
 }
開發者ID:AlexEvesDeveloper,項目名稱:hl-stuff,代碼行數:45,代碼來源:NewController.php

示例2: buildjs

function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($GLOBALS["CACHEFILE"]));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    $md5file = trim(md5_file($GLOBALS["LOGSFILES"]));
    echo "// CACHE FILE: {$GLOBALS["CACHEFILE"]} {$prc}%\n";
    echo "// LOGS FILE: {$GLOBALS["LOGSFILES"]} - {$md5file} " . strlen($md5file) . "\n";
    if ($prc == 0) {
        if (strlen($md5file) < 32) {
            echo "\n\t// PRC = {$prc} ; md5file={$md5file}\n\tfunction Start{$time}(){\n\t\t\tif(!RTMMailOpen()){return;}\n\t\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
            return;
        }
    }
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\t\tRTMMailHide();\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
}
開發者ID:articatech,項目名稱:artica,代碼行數:34,代碼來源:squid.global.wl.center.progress.php

示例3: shouldDeserialize

 /**
  * @test
  */
 public function shouldDeserialize()
 {
     $helper = new SamlSpInfoHelper();
     $expectedSamlSpInfo = $helper->getSamlSpInfo();
     $unserializedSamlSpInfo = unserialize(serialize($expectedSamlSpInfo));
     $this->assertEquals($expectedSamlSpInfo, $unserializedSamlSpInfo);
 }
開發者ID:iambrosi,項目名稱:SamlSPBundle,代碼行數:10,代碼來源:SamlSpInfoTest.php

示例4: testSerialization

 public function testSerialization()
 {
     $expression = new ParsedExpression('25', new ConstantNode('25'));
     $serializedExpression = serialize($expression);
     $unserializedExpression = unserialize($serializedExpression);
     $this->assertEquals($expression, $unserializedExpression);
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:7,代碼來源:ParsedExpressionTest.php

示例5: Main

function Main()
{
    //header('Content-Type: text/html; charset=iso-8859-1');
    if (isset($_SESSION['casores']) && $_SESSION['casores'] > 0) {
        if ($_POST['k']) {
            $idnodo = $_POST['k'];
            $res = new Resolucao();
            $res->setCodcaso($_SESSION['casores']);
            $hash = $res->BuscaConteudoPelaChave($idnodo);
            if ($hash != false) {
                $res->RegistraVisitaNodo($idnodo);
                if ($hash->ContainsKey("fim")) {
                    if ($hash->getValue("fim") == "S") {
                        // É fim do caso. Deve atualizar status
                        $u = unserialize($_SESSION['usu']);
                        $res->setCodusuario($u->getCodigo());
                        $res->setCodresolucao($_SESSION['codresolucao']);
                        if (!$res->ConcluiResolucao()) {
                            echo $res->getErro();
                        }
                    }
                }
                echo Comuns::Idioma($hash->ToXML());
            } else {
                die(Comuns::Idioma("ERRO: @lng[hash retornou false]"));
            }
        } else {
            die(Comuns::Idioma("ERRO: @lng[Conteúdo não informado]"));
        }
    } else {
        die(Comuns::Idioma("ERRO: @lng[Caso não encontrado]"));
    }
}
開發者ID:GoPlaceIn,項目名稱:siacc,代碼行數:33,代碼來源:ajaxbuscaparterescaso.php

示例6: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once dirname(__FILE__) . '/sfLimeHarness.class.php';
     $h = new sfLimeHarness(array('force_colors' => isset($options['color']) && $options['color'], 'verbose' => isset($options['trace']) && $options['trace']));
     $h->addPlugins(array_map(array($this->configuration, 'getPluginConfiguration'), $this->configuration->getPlugins()));
     $h->base_dir = sfConfig::get('sf_test_dir');
     $status = false;
     $statusFile = sfConfig::get('sf_cache_dir') . '/.test_all_status';
     if ($options['only-failed']) {
         if (file_exists($statusFile)) {
             $status = unserialize(file_get_contents($statusFile));
         }
     }
     if ($status) {
         foreach ($status as $file) {
             $h->register($file);
         }
     } else {
         // filter and register all tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($this->filterTestFiles($finder->in($h->base_dir), $arguments, $options));
     }
     $ret = $h->run() ? 0 : 1;
     file_put_contents($statusFile, serialize($h->get_failed_files()));
     if ($options['xml']) {
         file_put_contents($options['xml'], $h->to_xml());
     }
     return $ret;
 }
開發者ID:sensorsix,項目名稱:app,代碼行數:32,代碼來源:sfTestAllTask.class.php

示例7: viewthread_modoption

 public function viewthread_modoption()
 {
     global $_G;
     if (!$_G['adminid']) {
         return false;
     }
     $usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
     if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
         if (self::$util->isfounder($_G['member']) == false) {
             return false;
         }
     }
     $tid = $_G['tid'];
     $title = urlencode(trim($_G['forum_thread']['subject']));
     $post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
     include_once libfile('function/discuzcode');
     $content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
     $content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
     $content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
     $content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
     $content = strip_tags(discuzcode($content, 0, 0, 0));
     $content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
     $content = str_replace('&nbsp;', ' ', $content);
     $content = urlencode(cutstr($content, 50, ''));
     include template('qqgroup:push');
     return trim($return);
 }
開發者ID:tianyunchong,項目名稱:php,代碼行數:27,代碼來源:qqgroup.class.php

示例8: setReferrer

 /**
  * Set column referrer
  *
  * @param string $data The source data.
  * @return string
  */
 public static function setReferrer($data)
 {
     // unserialize
     $data = unserialize($data);
     // return correct data
     return isset($data['server']['HTTP_REFERER']) ? '<a href="' . $data['server']['HTTP_REFERER'] . '">' . $data['server']['HTTP_REFERER'] . '</a>' : '';
 }
開發者ID:naujasdizainas,項目名稱:forkcms,代碼行數:13,代碼來源:statistics.php

示例9: detail

 /**
  **	信息編輯
  **/
 public function detail()
 {
     $id = trim($this->input['id']);
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     }
     $info = array();
     $info['files'] = array();
     $info = $this->messagereceived->detail($id);
     $info['files'] = $this->messagereceived->detailfiles($id);
     $info['picture'] = array();
     $info['video'] = array();
     $info['annex'] = array();
     foreach ($info['files'] as $key => $value) {
         if ($value['typeid'] == 1) {
             $info['picture'][] = $value['host'] . $value['dir'] . $value['filepath'] . $value['filename'];
         }
         if ($value['typeid'] == 2) {
             $video_array = array();
             $video_vid = array();
             $video_vid = unserialize($value['backup']);
             $video_array['vid'] = $video_vid['vid'];
             $video_array['pic'] = $video_vid['pic'];
             $video_array['url'] = $value['host'] . $value['dir'] . "/" . $value['filepath'];
             $info['video'][] = $video_array;
         }
         if ($value['typeid'] == 3) {
             $info['annex'][] = $value;
         }
     }
     $this->addItem($info);
     $this->output();
 }
開發者ID:h3len,項目名稱:Project,代碼行數:36,代碼來源:message_received.php

示例10: fetchObjectFromCache

 protected function fetchObjectFromCache($key)
 {
     if (false === ($result = unserialize($this->cache->get($this->getHierarchyKey($key))))) {
         return [false, null];
     }
     return $result;
 }
開發者ID:aequasi,項目名稱:cache-1,代碼行數:7,代碼來源:RedisCachePool.php

示例11: initAuth

 /**
  * 初始化權限係統
  */
 protected function initAuth()
 {
     $this->config->load('allow');
     $this->allow = $this->config->item('allow');
     foreach ($this->allow as $key => $value) {
         $allow[$key] = $value['auth'];
     }
     if ($this->user['username'] != 'admin') {
         $this->load->model('Groups_model', 'groups');
         $groups = $this->groups->get($this->user['groups']);
         $auth = unserialize($groups->auth);
         foreach ($allow as $ctrl => $value) {
             if (array_key_exists($ctrl, $auth)) {
                 foreach ($value as $func => $value) {
                     if (!in_array($func, $auth[$ctrl])) {
                         unset($allow[$ctrl][$func]);
                     }
                 }
             } else {
                 unset($allow[$ctrl]);
             }
         }
     }
     $this->data['auth'] = $this->auth = $allow;
 }
開發者ID:wangwei1986,項目名稱:cms,代碼行數:28,代碼來源:QD_Controller.php

示例12: indexOp

 public function indexOp()
 {
     //查詢會員及其附屬信息
     $result = parent::pointshopMInfo(true);
     $member_info = $result['member_info'];
     unset($result);
     $model_member = Model('member');
     //獲得會員升級進度
     $membergrade_arr = $model_member->getMemberGradeArr(true, $member_info['member_exppoints'], $member_info['level']);
     Tpl::output('membergrade_arr', $membergrade_arr);
     //處理經驗值計算說明文字
     $exppoints_rule = C("exppoints_rule") ? unserialize(C("exppoints_rule")) : array();
     $ruleexplain_arr = array();
     $exppoints_rule['exp_orderrate'] = floatval($exppoints_rule['exp_orderrate']);
     if ($exppoints_rule['exp_orderrate'] > 0) {
         $ruleexplain_arr['exp_order'] = "經驗值以有效購物金額作為計算標準,有效購物金額{$exppoints_rule['exp_orderrate']}元=1經驗值;";
         $exp_ordermax = intval($exppoints_rule['exp_ordermax']);
         if ($exp_ordermax > 0) {
             $ruleexplain_arr['exp_order'] .= "單個訂單最多獲得{$exppoints_rule['exp_ordermax']}經驗值;";
         }
     }
     $exppoints_rule['exp_login'] = intval($exppoints_rule['exp_login']);
     if ($exppoints_rule['exp_login'] > 0) {
         $ruleexplain_arr['exp_login'] = "會員每天第一次登錄獲得{$exppoints_rule['exp_login']}經驗值;";
     }
     $exppoints_rule['exp_comments'] = intval($exppoints_rule['exp_comments']);
     if ($exppoints_rule['exp_comments'] > 0) {
         $ruleexplain_arr['exp_comments'] = "進行一次訂單商品評價將獲得{$exppoints_rule['exp_comments']}經驗值;";
     }
     Tpl::output('ruleexplain_arr', $ruleexplain_arr);
     //分類導航
     $nav_link = array(0 => array('title' => L('homepage'), 'link' => SHOP_SITE_URL), 1 => array('title' => L('nc_pointprod'), 'link' => urlShop('pointshop', 'index')), 2 => array('title' => '我的成長進度'));
     Tpl::output('nav_link_list', $nav_link);
     Tpl::showpage('pointgrade');
 }
開發者ID:mengtaolin,項目名稱:shopping,代碼行數:35,代碼來源:pointgrade.php

示例13: _dataInLocalLog

 private function _dataInLocalLog()
 {
     $modelGameOperateLog = $this->_getGlobalData('Model_GameOperateLog', 'object');
     $this->_loadCore('Help_SqlSearch');
     //載入sql工具
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($modelGameOperateLog->tName());
     $helpSqlSearch->set_conditions("game_server_id=" . intval($_REQUEST['server_id']));
     $helpSqlSearch->set_conditions("operate_type=" . self::LOGTYPE);
     $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE);
     $helpSqlSearch->set_orderBy('Id desc');
     $sql = $helpSqlSearch->createSql();
     $data = $modelGameOperateLog->select($sql);
     $users = $this->_getGlobalData('user_index_id');
     //獲得所有用戶的數組
     foreach ($data as &$sub) {
         $sub['user_id'] = $users[$sub['user_id']];
         $sub['create_time'] = date('Y-m-d H:i:s', $sub['create_time']);
         $sub['URL_del'] = $this->_urlLockAccountDel($sub['game_user_id'], $sub['game_user_account'], $sub['game_user_nickname']);
         $sub['info'] = unserialize($sub['info']);
         $sub['endTime'] = $sub['info']['FromGame']['endTime'];
     }
     $this->_assign['dataList'] = $data;
     $this->_loadCore('Help_Page');
     //載入分頁工具
     $conditions = $helpSqlSearch->get_conditions();
     $helpPage = new Help_Page(array('total' => $modelGameOperateLog->findCount($conditions), 'perpage' => PAGE_SIZE));
     $this->_assign['pageBox'] = $helpPage->show();
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:29,代碼來源:Default_1.class.php

示例14: setUp

 protected function setUp()
 {
     $this->_data['PRODUCT'] = unserialize(file_get_contents(PATH_DADOS . 'products.reg'));
     $this->_data['PROVIDERS'] = unserialize(file_get_contents(PATH_DADOS . 'providers.reg'));
     $this->_data['SECTOR'] = unserialize(file_get_contents(PATH_DADOS . 'sector.reg'));
     $this->_data['TURNOVERS'] = unserialize(file_get_contents(PATH_DADOS . 'turnovers.reg'));
 }
開發者ID:silasrm,項目名稱:Backup-PHP,代碼行數:7,代碼來源:BackupTest.php

示例15: __construct

 public function __construct()
 {
     parent::_initialize();
     $this->token = $this->_get('token');
     $this->wecha_id = $this->wecha_id;
     if (!$this->token) {
         $product_cart_model = M('product_cart');
         $out_trade_no = $this->_get('out_trade_no');
         $order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
         if (!$order) {
             $order = $product_cart_model->where(array('id' => intval($this->_get('out_trade_no'))))->find();
         }
         $this->token = $order['token'];
     }
     $payConfig = M('Alipay_config')->where(array('token' => $this->token))->find();
     $payConfigInfo = unserialize($payConfig['info']);
     $this->payConfig = $payConfigInfo['weixin'];
     if (ACTION_NAME == 'pay' || ACTION_NAME == 'new_pay') {
         if (empty($this->payConfig['is_old'])) {
             $this->new_pay();
             exit;
         } else {
             $this->pay();
             exit;
         }
     }
 }
開發者ID:hehekeke,項目名稱:pigcms,代碼行數:27,代碼來源:WeixinAction.class.php


注:本文中的unserialize函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。