本文整理汇总了PHP中utf8ize函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8ize函数的具体用法?PHP utf8ize怎么用?PHP utf8ize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8ize函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: utf8ize
function utf8ize($d)
{
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else {
if (is_string($d)) {
return utf8_encode($d);
}
}
return $d;
}
开发者ID:heigold1,项目名称:newscheck,代码行数:13,代码来源:newsproxy.php
示例2: utf8ize
function utf8ize($mixed)
{
if (is_array($mixed)) {
foreach ($mixed as $key => $value) {
$mixed[$key] = utf8ize($value);
}
} else {
if (is_string($mixed)) {
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($mixed, "UTF-8", "auto");
} else {
return utf8_encode($mixed);
}
}
}
return $mixed;
}
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:17,代码来源:vmjsapi.php
示例3: utf8ize
function utf8ize($mixed) {
if (is_array($mixed)) {
foreach ($mixed as $key => $value) {
$mixed[$key] = utf8ize($value);
}
} else if (is_string ($mixed)) {
return utf8_encode($mixed);
}
return $mixed;
}
开发者ID:suavid,项目名称:warbook,代码行数:10,代码来源:alias.php
示例4: getList
function getList($tableName, $tableColumn)
{
$sql = "select * FROM {$tableName} ORDER BY {$tableColumn}";
try {
$db = getConnection();
$stmt = $db->query($sql);
$list = $stmt->fetchAll(PDO::FETCH_ASSOC);
$db = null;
echo json_encode(utf8ize($list), JSON_NUMERIC_CHECK);
} catch (PDOException $e) {
echo '{"error":{"text":' . $e->getMessage() . '}}';
}
}
开发者ID:alinanmorariu,项目名称:Sibiu-halfmarathon-app,代码行数:13,代码来源:listsFunctions.php
示例5: get_by_user
function get_by_user($user, $db)
{
$exercises = array();
$exercises["data"] = '';
$exercises["status"] = 'failed';
$exercises["error_message"] = '';
if ($db->connect_errno) {
$exercises["status"] = 'failed';
$exercises["error_message"] = $db->connect_error;
} else {
if ($sql_cmd = $db->prepare("SELECT DISTINCT(e.`id`), e.`title`, e.`content`,\n\t\t\t\t\t\t\t\t\t\t\te.`user_create`, e.`created_time`,\n\t\t\t\t\t\t\t\t\t\t\ted.`rating`, ed.`difficulty`, ed.`view_count`,\n\t\t\t\t\t\t\t\t\t\t\tc.`name`\n\t\t\t\t\t\t\t\t\t FROM `exercise` e\n\t\t\t\t\t\t\t\t\t INNER JOIN `exercise_detail` ed ON ed.`id` = e.`id`\n\t\t\t\t\t\t\t\t\t INNER JOIN `category` c ON c.`id` = e.`cat_id`\n\t\t\t\t\t\t\t\t\t WHERE e.`user_create` = ?\n\t\t\t\t\t\t\t\t\t ORDER BY ed.`view_count`\n\t\t\t\t\t\t\t\t\t LIMIT 10")) {
$sql_cmd->bind_param("s", $user);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($id, $title, $content, $user_create, $created_time, $rating, $difficulty, $view_count, $cat_name);
while ($sql_cmd->fetch()) {
$exercise = array();
$exercise["id"] = $id;
$exercise["title"] = $title;
$exercise["content"] = $content;
$exercise["user_create"] = $user_create;
$exercise["created_time"] = $created_time;
$exercise["rating"] = $rating;
$exercise["difficulty"] = $difficulty;
$exercise["view_count"] = $view_count;
$exercise["cat_name"] = $cat_name;
$exercises["data"][] = $exercise;
}
} else {
$exercises["status"] = 'failed';
$exercises["error_message"] = $sql_cmd->error;
}
$sql_cmd->close();
} else {
$exercises["status"] = 'failed';
$exercises["error_message"] = $db->error;
}
get_tag($exercises, $db);
$exercises["status"] = $exercises["error_message"] == '' ? 'success' : 'failed';
echo json_encode(utf8ize($exercises['data']), JSON_PRETTY_PRINT);
// printf("<pre>%s</pre>", $json);
$db->close();
}
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:43,代码来源:exercise_get_by_userid.php
示例6: dirname
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$t = json_decode(file_get_contents("php://input"));
$key = $t->key;
$key = "%{$key}%";
$db = DbInstance::getInstance();
$tags = array();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("SELECT `id`, `name` FROM `tag` WHERE `name` LIKE ? LIMIT 5")) {
$sql_cmd->bind_param("s", $key);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($id, $name);
while ($sql_cmd->fetch()) {
$tag = array();
$tag["id"] = $id;
$tag["name"] = $name;
$tags[] = $tag;
}
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command get like";
}
echo json_encode(utf8ize($tags), JSON_PRETTY_PRINT);
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:30,代码来源:tag_get_like.php
示例7: dirname
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$solution = json_decode(file_get_contents("php://input"));
$user_id = (int) $solution->user_id;
$db = DbInstance::getInstance();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("SELECT `id`, `content`, `ex_id` FROM `solution` WHERE `user_create` = ? LIMIT 20")) {
$sql_cmd->bind_param("i", $user_id);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($id, $content, $ex_id);
$solutions = array();
while ($sql_cmd->fetch()) {
$solution = array();
$solution["id"] = $id;
$solution["content"] = $content;
$solution["ex_id"] = $ex_id;
$solutions[] = $solution;
}
echo json_encode(utf8ize($solutions), JSON_PRETTY_PRINT);
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command";
}
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:30,代码来源:solution_get_by_userid.php
示例8: dirname
<?php
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$comment = json_decode(file_get_contents("php://input"));
$content = $comment->content;
$user_create = $comment->user_create;
$ex_id = (int) $comment->ex_id;
$db = DbInstance::getInstance();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("INSERT INTO `comment`(`content`, `ex_id`, `user_create`) VALUES (?, ?, ?)")) {
$sql_cmd->bind_param("sii", $content, $ex_id, $user_create);
if ($sql_cmd->execute()) {
// echo ($sql_cmd->affected_rows == 1) ? "success" : "No comment inserted";
$comment = array();
$comment["id"] = $sql_cmd->insert_id;
$comment["content"] = $content;
$comment["user_name"] = $user_create;
echo json_encode(utf8ize($comment), JSON_PRETTY_PRINT);
} else {
echo $sql_cmd->error;
}
$sql_cmd->close();
} else {
echo "Can not prepare the command";
}
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:30,代码来源:comment_create.php
示例9: dirname
<?php
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$report = json_decode(file_get_contents("php://input"));
$user_id = (int) $report->user_id;
$db = DbInstance::getInstance();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("SELECT `id`, `content` FROM `report` WHERE user_create = ? LIMIT 20")) {
$sql_cmd->bind_param("i", $user_id);
if ($sql_cmd->execute()) {
$reports = array();
$sql_cmd->bind_result($id, $content);
while ($sql_cmd->fetch()) {
$reports[$id] = $content;
}
echo json_encode(utf8ize($reports), JSON_PRETTY_PRINT);
} else {
echo $sql_cmd->error;
}
$sql_cmd->close();
} else {
echo "Can not prepare the command";
}
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:28,代码来源:report_get_by_userid.php
示例10: dirname
<?php
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$id = 8;
$db = DbInstance::getInstance();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("SELECT `content`, `user_create` FROM `solution` WHERE `id` = ? LIMIT 20")) {
$sql_cmd->bind_param("i", $id);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($content, $user_id);
$solution = array();
while ($sql_cmd->fetch()) {
$solution["id"] = $id;
$solution["content"] = $content;
$solution["user_id"] = $user_id;
}
echo json_encode(utf8ize($solution));
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command";
}
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:29,代码来源:solution_get_by_id.php
示例11: printf
$exercise["view_count"] = $view_count;
$exercise["cat_name"] = $cat_name;
$exercises[] = $exercise;
}
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command [get exercise detail]";
}
for ($i = 0; $i < count($exercises); $i++) {
$ex_id = $exercises[$i]["id"];
$exercises[$i]["tag"] = get_tag((int) $ex_id, $db);
}
$json = json_encode(utf8ize($exercises), JSON_PRETTY_PRINT);
printf("<pre>%s</pre>", $json);
$db->close();
}
function get_tag($id, $db)
{
$tags = array();
if ($sql_cmd = $db->prepare("SELECT DISTINCT (t.`id`), t.`name`\n\t\t\t\t\t\t\t\t FROM `tag` t\n\t\t\t\t\t\t\t\t INNER JOIN `exercise_tag` et ON et.`tag_id` = t.`id`\n\t\t\t\t\t\t\t\t WHERE et.`ex_id` = ?")) {
$sql_cmd->bind_param("i", $id);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($tag_id, $name);
while ($sql_cmd->fetch()) {
$tag = array();
$tag["id"] = $id;
$tag["name"] = $name;
$tags[] = $tag;
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:31,代码来源:exercise_get_by_tag.php
示例12: updateSupporter
function updateSupporter($id)
{
global $app;
$req = $app->request();
$supporter = json_decode($req->getBody());
$sql = "UPDATE sustinatori SET prenume=:prenume, nume=:nume, observatii=:observatii, companie=:companie, telefon=:telefon, email=:email,\n adresa=:adresa, localitate=:localitate, sustin=:sustin, suma=:suma, fixa=:fixa, promisi=:promisi, suma_platita=:suma_platita, \n platiti=:platiti, tipPlata=:tipPlata, documentJustificativ=:documentJustificativ, dataPlata=:dataPlata, anonim=:anonim, contactOrganizatie=:contactOrganizatie \n WHERE sustinatorID=:sustinatorID";
try {
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindParam("prenume", $supporter->prenume);
$stmt->bindParam("nume", $supporter->nume);
$stmt->bindParam("observatii", $supporter->observatii);
$stmt->bindParam("companie", $supporter->companie);
$stmt->bindParam("telefon", $supporter->telefon);
$stmt->bindParam("email", $supporter->email);
$stmt->bindParam("adresa", $supporter->adresa);
$stmt->bindParam("localitate", $supporter->localitate);
$stmt->bindParam("sustin", $supporter->sustin);
$stmt->bindParam("suma", $supporter->suma);
$stmt->bindParam("fixa", $supporter->fixa);
$stmt->bindParam("promisi", $supporter->promisi);
$stmt->bindParam("suma_platita", $supporter->suma_platita);
$stmt->bindParam("platiti", $supporter->platiti);
$stmt->bindParam("tipPlata", $supporter->tipPlata);
$stmt->bindParam("documentJustificativ", $supporter->documentJustificativ);
$stmt->bindParam("dataPlata", $supporter->dataPlata);
$stmt->bindParam("anonim", $supporter->anonim);
$stmt->bindParam("contactOrganizatie", $supporter->contactOrganizatie);
$stmt->bindParam("sustinatorID", $id);
$stmt->execute();
$db = null;
echo json_encode(utf8ize($supporter));
} catch (PDOException $e) {
echo json_encode($e->getMessage());
}
}
开发者ID:alinanmorariu,项目名称:Sibiu-halfmarathon-app,代码行数:36,代码来源:itemsFunctions.php
示例13: dirname
<?php
require_once dirname(__DIR__) . "/includes/db_instance.php";
require_once dirname(__DIR__) . "/includes/utf8_utils.php";
$db = DbInstance::getInstance();
$categories = array();
if ($db->connect_errno) {
printf("Connect failed: %s\n", $db->connect_error);
} else {
if ($sql_cmd = $db->prepare("SELECT `id`, `name` FROM `category` LIMIT 20")) {
if ($sql_cmd->execute()) {
$categories = array();
$sql_cmd->bind_result($id, $name);
while ($sql_cmd->fetch()) {
$category = array();
$category["id"] = $id;
$category["name"] = $name;
$categories[] = $category;
}
echo json_encode(utf8ize($categories), JSON_PRETTY_PRINT);
} else {
echo $sql_cmd->error;
}
$sql_cmd->close();
} else {
echo "Can not prepare the command";
}
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:29,代码来源:category_get_all.php
示例14: safe_json_encode
function safe_json_encode($value)
{
$encoded = json_encode($value);
return json_last_error() == JSON_ERROR_NONE ? $encoded : json_encode(utf8ize($value));
}
开发者ID:Rapiddot,项目名称:ruTorrent,代码行数:5,代码来源:util.php
示例15: printf
$exercise["reports"] = $reports;
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command [get report]";
}
// Get tags
if ($sql_cmd = $db->prepare("SELECT t.`id`, t.`name`\n\t\t\t\t\t\t\t\tFROM `tag` t\n\t\t\t\t\t\t\t\tINNER JOIN `exercise_tag` et ON et.`tag_id` = t.`id`\n\t\t\t\t\t\t\t\tWHERE et.`ex_id` = ?;")) {
$sql_cmd->bind_param("i", $ex_id);
if ($sql_cmd->execute()) {
$sql_cmd->bind_result($id, $name);
$tags = array();
while ($sql_cmd->fetch()) {
$tag = array();
$tag["id"] = $id;
$tag["name"] = $name;
$tags[] = $tag;
}
$exercise["tags"] = $tags;
} else {
printf("Command execution failed: %s", $sql_cmd->error);
}
$sql_cmd->close();
} else {
echo "Can not prepare the command [get solution]";
}
echo json_encode(utf8ize($exercise), JSON_PRETTY_PRINT);
$db->close();
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:31,代码来源:exercise_get_by_id.php
示例16: utf8ize
function utf8ize(&$mixed)
{
if (is_array($mixed)) {
foreach ($mixed as $key => $value) {
$mixed[$key] = utf8ize($value);
}
} else {
if (is_string($mixed)) {
return utf8_encode($mixed);
}
}
#return mb_convert_encoding($mixed,'UTF-8','Windows-1252');#
return $mixed;
}
开发者ID:Ben749,项目名称:racetrack,代码行数:14,代码来源:fun.php
示例17: utf8ize
function utf8ize($d)
{
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else {
if (is_object($d)) {
foreach ($d as $k => $v) {
$d->{$k} = utf8ize($v);
}
} else {
return utf8_encode($d);
}
}
return $d;
}
开发者ID:YaleMakes,项目名称:HumanEcosystems,代码行数:17,代码来源:getUsers.php
注:本文中的utf8ize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论