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


PHP Encoding::json_encode_utf8方法代码示例

本文整理汇总了PHP中Encoding::json_encode_utf8方法的典型用法代码示例。如果您正苦于以下问题:PHP Encoding::json_encode_utf8方法的具体用法?PHP Encoding::json_encode_utf8怎么用?PHP Encoding::json_encode_utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Encoding的用法示例。


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

示例1: sprintf

    }
    $copyright_holders[] = sprintf("<a href='%s'>%s</a>", $org_url, $org_name);
}
$year = date('Y');
$legal_buf = preg_replace('/<!-- YEAR -->/', $year, $legal_buf);
$legal_buf = preg_replace('/<!-- COPYRIGHT_HOLDER -->/', implode(', ', $copyright_holders), $legal_buf);
if (!$callback) {
    ?>
<html>
 <head>
  <link rel="stylesheet" href="css/pinform.css"/>
  <style>
    body {
        font: 15px Helvetica, Helvetica Neue, Arial, 'sans serif';
    }
  </style>
 </head>
 <body>
 <?php 
    echo $legal_buf;
    ?>
 </body>
</html>
<?php 
} else {
    $legal_json = Encoding::json_encode_utf8(array('legal' => $legal_buf));
    header("Content-Type: application/json");
    echo "{$callback}(";
    echo $legal_json;
    echo ")";
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:31,代码来源:legal.php

示例2:

                }
            },
            user_ethnicity : {
                label : AIR2.Fixtures.FieldLabels['user_ethnicity'],
                fact_identifier : 'ethnicity'
            },
            birth_year : {
                label : 'Age'
            },
            tag : {
                label : 'Tag'
            },
            prj_uuid : {
                label : 'Project',
                itemLabels : <?php 
echo Encoding::json_encode_utf8($prj_names);
?>
            }


        };

        var app = new AIR2.UI.App({
            items: AIR2.SearchPanel({
                title           : '<?php 
echo $search_label;
?>
',
                searchUrl       : '<?php 
echo $search_url;
?>
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:31,代码来源:sources.php

示例3: write_file

 /**
  *
  *
  * @return unknown
  */
 public function write_file()
 {
     $path = $this->get_file_path();
     air2_mkdir(dirname($path));
     $params = $this->srs;
     $params['meta'] = $this->meta;
     // handle file uploads first, because we need to alter $params
     // to reflect target file name
     if ($this->has_files) {
         foreach ($params as $ques_uuid => $param_value) {
             if (is_array($param_value) && isset($param_value['orig_name'])) {
                 $upload_dir = sprintf("%s/%s.uploads", dirname($path), $this->uuid);
                 $target_file = sprintf("%s/%s.%s", $upload_dir, $ques_uuid, $param_value['file_ext']);
                 air2_mkdir($upload_dir);
                 if (move_uploaded_file($param_value['tmp_name'], $target_file)) {
                     chmod($target_file, 0664);
                 }
                 $params[$ques_uuid]['tmp_name'] = $target_file;
                 // for reaper
             }
         }
     }
     $json = Encoding::json_encode_utf8($params);
     $bytes = file_put_contents($path, $json);
     return $bytes;
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:31,代码来源:AIR2_Submission.php

示例4:

              '</tpl>',
              '</li>',
              '<li class="air2-search-created">Created {[AIR2.Format.dateHuman(values.prj_cre_dtim)]} by ',
               '{[AIR2.Format.createLink(values.author_fl, "/user/"+values.author_uuid, true)]}',
              '</li>',
             '</ul>',
            '</div>',
           '</tpl>'
        );

        var facetDefs = {

            org_uuid : {
                label : 'Organization',
                itemLabels : <?php 
echo Encoding::json_encode_utf8($org_uuids);
?>
            },

            tag : {
                label : 'Tag'
            }


        };

        var app = new AIR2.UI.App({
            items: AIR2.SearchPanel({
                title       : 'Projects',
                searchUrl   : '<?php 
echo $search_url;
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:31,代码来源:projects.php

示例5: header

        header('X-PIN: success', false, 202);
    } else {
        // problem writing the temp file (bad news)
        header('X-PIN: internal server error with storing submission. Try again later.', false, 500);
    }
    // send response
    if ($response_content_type == 'text/html') {
        print '<textarea>';
        print Encoding::json_encode_utf8($response);
        print '</textarea>';
    } elseif ($response_content_type == 'application/json') {
        $needs_jsonp = isset($_GET['callback']) ? $_GET['callback'] : false;
        if ($needs_jsonp) {
            print "{$needs_jsonp}(";
        }
        print Encoding::json_encode_utf8($response);
        if ($needs_jsonp) {
            print ")";
        }
    }
} else {
    // TODO handle HTML response
}
/**
 * Returns referer value from either X-PIN-referer POST param or HTTP header.
 *
 * @return unknown
 */
function get_referer()
{
    if (isset($_POST['X-PIN-referer'])) {
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:31,代码来源:submit.php

示例6: asJSON

 /**
  * Returns object as JSON string. Only immediate columns
  * (no related objects) are encoded.
  *
  * @return $json
  */
 public function asJSON()
 {
     $cols = $this->toArray(false);
     return Encoding::json_encode_utf8($cols);
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:AIR2_Record.php


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