本文整理汇总了PHP中FileHelper::indent_json方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHelper::indent_json方法的具体用法?PHP FileHelper::indent_json怎么用?PHP FileHelper::indent_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::indent_json方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndentJson
public function actionIndentJson()
{
return Rest::json(array('jsonindent' => FileHelper::indent_json($_POST['jsonnonindent'])));
}
示例2: createMappingWithJSON
public static function createMappingWithJSON($post)
{
$json_array = json_decode($post['json_origine'], true);
$jsonMapping["src"] = $post['source'];
//json mapping
if ($post['chooseSelected'] == "new") {
$jsonMapping["date_create"] = date("d/m/y");
} else {
$oneMapping = PHDB::findOne(City::COLLECTION_IMPORTHISTORY, array("_id" => new MongoId($post['mappingSelected'])));
$jsonMapping["date_create"] = $oneMapping["date_create"];
// $jsonmapping["lastImportId"] = $oneMapping['lastImportId'];
}
$jsonMapping["date_update"] = date("d/m/y");
$jsonMapping["url"] = $post['url'];
$jsonMapping["nameFile"] = $post['nameFile'];
$jsonMapping["lien"] = $post['lien'];
foreach ($post['tabmapping'] as $key => $value) {
if ($value != '') {
$jsonfilsFields[$post['tabidmapping'][$key]] = $value;
}
}
$jsonMapping["fields"] = $jsonfilsFields;
$idLien = $post['lien'];
$cheminLien = explode(".", $idLien);
//var_dump($cheminLien);
$valueIdLien = FileHelper::get_value_json($json_array, $cheminLien);
//var_dump($valueIdLien);
$res = PHDB::findOne(City::COLLECTION, array("insee" => $valueIdLien));
$inc_import = 0;
$inc_rejet = 0;
if ($res != null) {
$commune["insee"] = $valueIdLien;
foreach ($jsonMapping['fields'] as $key => $value) {
$map = explode(".", $value);
$cheminJson = explode(".", $key);
$value_json = FileHelper::get_value_json($json_array, $cheminJson);
if (!isset($commune[$map[0]])) {
if (count($map) > 1) {
$newmap = array_splice($map, 1);
$commune[$map[0]] = FileHelper::create_json($newmap, $value_json);
} else {
$commune[$map[0]] = $value_json;
}
} else {
if (count($map) > 1) {
$newmap = array_splice($map, 1);
$commune[$map[0]] = FileHelper::create_json_with_father($newmap, $value_json, $commune[$map[0]]);
} else {
$commune[$map[0]] = $value_json;
}
}
}
} else {
foreach ($jsonMapping['fields'] as $key => $value) {
$map = explode(".", $value);
$cheminJson = explode(".", $key);
if (!isset($rejet[$valueIdLien])) {
if (count($map) > 1) {
$newmap = array_splice($map, 1);
$rejet[$map[0]] = FileHelper::create_json_with_father($newmap, $value_json);
} else {
$rejet[$map[0]] = $value_json;
}
} else {
if (count($map) > 1) {
$newmap = array_splice($map, 1);
$rejet[$map[0]] = FileHelper::create_json_with_father($newmap, $value_json, $rejet[$map[0]]);
} else {
$rejet[$map[0]] = $value_json;
}
}
}
}
if (isset($commune)) {
$jsonimport = $commune;
} else {
$jsonimport = [];
$arrayCsvImport = [];
}
if (isset($rejet)) {
$jsonrejet = $rejet;
} else {
$jsonrejet = [];
$arrayCsvRejet = [];
}
$params = array('result' => true, 'jsonmapping' => FileHelper::indent_json(json_encode($jsonMapping)), "jsonimport" => FileHelper::indent_json(json_encode($jsonimport)), "jsonrejet" => FileHelper::indent_json(json_encode($jsonrejet)), "lien" => $post['lien']);
return $params;
}