本文整理汇总了PHP中WebUtils::jsonEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP WebUtils::jsonEncode方法的具体用法?PHP WebUtils::jsonEncode怎么用?PHP WebUtils::jsonEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebUtils
的用法示例。
在下文中一共展示了WebUtils::jsonEncode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($tid, $act = 'apply')
{
$data = TopicUtils::getActivityInfo($tid);
$data = $data['action']['info'];
$errorMsg = '';
if (!empty($_POST)) {
// discuz 源码会在mobile情况下把POST的数据转码成对应的charset,
// 由于这里需要强制使用utf-8,且dz本身并没有修改$_REQUEST变量
$_POST = array_intersect_key($_REQUEST, $_POST);
$requestData = WebUtils::jsonEncode($_POST, 'utf-8');
$res = WebUtils::httpRequestAppAPI('forum/topicactivity', array('tid' => $tid, 'act' => $act, 'json' => rawurlencode($requestData)));
if (($res = WebUtils::jsonDecode($res)) != false && $res['head']['errCode'] == MOBCENT_ERROR_NONE) {
$this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
}
if ($res != false) {
$errorMsg = $res['head']['errInfo'];
}
}
// render
$viewFile = 'topicActivity';
$this->getController()->renderPartial($viewFile, array('data' => $data, 'errorMsg' => $errorMsg, 'formUrl' => WebUtils::createUrl_oldVersion('forum/topicactivityview', array('tid' => $tid, 'act' => $act))));
}
示例2: rawurlencode
?>
</p>
</div>
<?php
}
?>
</div>
</div>
<?php
} else {
?>
<div class="uidiy-mobileui-component" data-component-data="<?php
$component['title'] = '帖子列表';
$component['type'] = 'topiclist';
$component['extParams']['forumId'] = $v['board_id'];
echo rawurlencode(WebUtils::jsonEncode($component, 'utf-8'));
?>
">
<div class="col-xs-9 double-div">
<div class="row">
<?php
if ($vv['board_img']) {
?>
<div class="col-xs-2">
<div class="board-img">
<img src="<?php
echo $vv['board_img'];
?>
" class="board-img-set">
</div>
</div>
示例3: actionMakeThumb
public function actionMakeThumb($count = 10)
{
$thumbTaskList = CacheUtils::getDzPluginCache('thumb_task_list');
$thumbTaskList === false && ($thumbTaskList = array());
$count <= 0 && ($count = count($thumbTaskList));
$count = min(count($thumbTaskList), $count);
$i = 0;
foreach ($thumbTaskList as $key => $thumb) {
if ($i >= $count) {
break;
}
ImageUtils::getThumbImageEx($thumb, 20, false, false, true);
$i++;
}
echo WebUtils::jsonEncode($thumbTaskList);
array_splice($thumbTaskList, 0, $count);
CacheUtils::setDzPluginCache('thumb_task_list', $thumbTaskList);
}
示例4: doAPNs
public static function doAPNs($localCertFile, $passphrase, $deviceToken, $payload, $timeout = 10, $charset = '')
{
// https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
$res = false;
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $localCertFile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$url = 'ssl://gateway.push.apple.com:2195';
// $url = 'ssl://gateway.sandbox.push.apple.com:2195'; // test
if ($fp = stream_socket_client($url, $err, $errstr, $timeout, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx)) {
stream_set_timeout($fp, $timeout);
$payload = WebUtils::jsonEncode($payload, $charset);
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
fwrite($fp, $msg, strlen($msg)) && ($res = true);
fclose($fp);
}
return $res;
}
示例5: actionArticleInfo
public function actionArticleInfo($aid)
{
$article = PortalUtils::getNewsInfo($aid);
echo WebUtils::jsonEncode($article);
}
示例6: ReflectionClass
?>
,
layoutInitParams: <?php
echo WebUtils::jsonEncode(AppbymeUIDiyModel::initLayout(), 'utf-8');
?>
,
moduleInitList: <?php
echo WebUtils::jsonEncode($modules, 'utf-8');
?>
,
navItemInitParams: <?php
echo WebUtils::jsonEncode(AppbymeUIDiyModel::initNavItem(), 'utf-8');
?>
,
navItemInitList: <?php
echo WebUtils::jsonEncode($navInfo['navItemList'], 'utf-8');
?>
,
};
<?php
$reflect = new ReflectionClass('AppbymeUIDiyModel');
foreach ($reflect->getConstants() as $key => $value) {
echo "var {$key} = '{$value}';";
}
?>
var SUBNAV_MAX_COMPONENT_LEN = 4;
</script>
<script src="<?php
echo $this->rootUrl;
?>
/js/jquery-2.0.3.min.js"></script>
示例7: array
</li>
<?php
}
?>
</ul>
<?php
$this->renderPartial('component_mobile_ui', array('component' => $subnavInfo[$j]));
?>
</div>
<?php
}
?>
<script>
function getProtalInfo(i){
var moduleInfo = <?php
echo WebUtils::jsonEncode($module, 'utf-8');
?>
;
moduleInfo['select'] = i;
$.ajax({
type:"POST",
url:Appbyme.getAjaxApiUrl('admin/uidiy/modulemobileui'),
data:{
module: JSON.stringify(moduleInfo),
},
dataType:"html",
success:function(msg) {
$('.module-mobile-ui-view').html(msg);
}
});
}
示例8: rawurlencode
}
?>
<?php
if ($customStyle['extParams']['styleHeader']['isShow'] == 1 && $customStyle['extParams']['styleHeader']['position'] == 0) {
?>
<div class="custom-style-title">
<p class="pull-left"><?php
echo WebUtils::subString($customStyle['extParams']['styleHeader']['title'], 0, 15, 'UTF-8');
?>
</p>
<?php
if ($customStyle['extParams']['styleHeader']['isShowMore'] == 1) {
?>
<p class="pull-right moreComponent uidiy-mobileui-component" data-component-data="<?php
echo rawurlencode(WebUtils::jsonEncode($customStyle['extParams']['styleHeader']['moreComponent'], 'utf-8'));
?>
">更多</p>
<?php
}
?>
</div>
<?php
}
?>
</div><!-- 风格区结束 -->
<?php
}
?>
</div><!-- 自定义页面整体结束 -->
示例9: elseif
" src="<?php
echo $this->rootUrl;
?>
/images/admin/topbar/mc_forum_weather_icon2.png">
<?php
} elseif ($rightTopbars['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_SIGN) {
?>
<div class="pull-right uidiy-mobileui-component" data-component-data="<?php
echo rawurlencode(WebUtils::jsonEncode($rightTopbars, 'utf-8'));
?>
" style="margin:3px 5px 0px 5px;cursor:pointer;">签到</div>
<?php
} elseif ($rightTopbars['type'] != AppbymeUIDiyModel::COMPONENT_TYPE_EMPTY) {
?>
<img class="pull-right select-topbar-btn uidiy-mobileui-component" data-component-data="<?php
echo rawurlencode(WebUtils::jsonEncode($rightTopbars, 'utf-8'));
?>
" src="<?php
echo $this->getComponentIconUrl($rightTopbars['icon']);
?>
">
<?php
}
?>
<?php
}
?>
</div>
<!-- @author HanPengyu -->
<?php
示例10: _decodeConfig
private function _decodeConfig($config)
{
$res = array();
$tmpConfig = base64_decode($config);
$tmpConfig = WebUtils::jsonDecode($tmpConfig);
if (isset($tmpConfig['data']) && isset($tmpConfig['dataChecksum']) && $tmpConfig['dataChecksum'] == md5(WebUtils::jsonEncode($tmpConfig['data'], 'utf-8'))) {
$res = $tmpConfig['data'];
}
return $res;
}