Tag:io os use ar for data 2014 on cti
Process time section, convert isodate ("2014-10-09t18:37:50.0z") to 2014-10-09 18:37:50 This format//up to 6 layers of tree structure data, when a multidimensional array of key, contains an array $product_ Any one of the characters in the Date_col, then it will be processed. public static function Processmongogetdate ($product) {foreach ($product as $k 1=> $v 1) {if (!is_array ($v 1) &&! Is_object ($v 1)) {}else{//if (Self::contentdate ($k 1, $product _date_col)) {if ($v 1->sec) {$v 1 = date (' y-m-d h:i:s ', $ V1->SEC);} $product [$k 1] = $v 1;//}foreach ($v 1 as $k 2=> $v 2) {if (!is_array ($v 2) &&!is_object ($v 2)) {}else{//if (self:: Contentdate ($k 2, $product _date_col)) {if ($v 2->sec) {$v 2 = date (' y-m-d h:i:s ', $v 2->sec);} $product [$k 1][$k 2] = $v 2;//}foreach ($v 2 as $k 3=> $v 3) {if (!is_array ($v 3) &&!is_object ($v 3)) {}else{//if ( Self::contentdate ($k 3, $product _date_col)) {if ($v 3->sec) {$v 3 = date (' y-m-d h:i:s ', $v 3->sec);} $product [$k 1][$k 2][$k 3] = $v 3;//}foreach ($v 3 as $k 4=> $v 4) {if (!is_array ($v 4) &&!is_object ($v 4)) {}else{// if (Self::contentdate ($k 4, $product _date_col)) {if ($v 4->sec) {$v 4 = date (' y-m-d h:i:s ', $v 4-> sec);} $product [$k 1][$k 2][$k 3][$k 4] = $v 4;//}foreach ($v 4 as $k 5=> $v 5) {if (!is_array ($v 5) &&!is_object ($v 5)) {} Else{//if (Self::contentdate ($k 5, $product _date_col)) {if ($v 5->sec) {$v 5 = date (' y-m-d h:i:s ', $v 5->sec);} $product [$k 1][$k 2][$k 3][$k 4][$k 5] = $v 5;//}foreach ($v 5 as $k 6=> $v 6) {if (!is_array ($v 6) &&!is_object ($v 6)) {}else{//if (Self::contentdate ($k 6, $product _date_col)) {if ($v 6->sec) {$v 6 = date (' y-m-d h:i:s ', $v 6->sec);} $product [$k 1][$k 2][$k 3][$k 4][$k 5][$k 6] = $v 6;//}}}}}}}}}}}}}return $product;} /* Function: The data passed by the front-end form, whether saved or queried, needs to be converted into MONGO format * Processing: 1. Numeric string converted to float type, 2. Date converted to MONGO format using \mongodate (). * Result: This function is only a conversion field type. A table of up to 6 layers of tree-shaped structure. */public static function Processmongosetdata ($data, $float _array) {//?gte? lte$product = Object_to_array ($data); $ Productfloat = $float _array;foreach ($product as $k 1=> $v 1) {if (!is_array ($v 1) &&!is_object ($v 1)) {if (in_ Array ($k 1, $productfloat)) {if (Is_numeric ($v 1)) {$v 1 = floatval ($v 1); $product [$k 1] = $v 1;}} if (Is_time ($v 1)) {$product[$k 1] = new \mongodate (Strtotime ($v 1));}} Else{foreach ($v 1 as $k 2=> $v 2) {if (!is_array ($v 2) &&!is_object ($v 2)) {if (In_array ($k 2, $productfloat)) {if ( Is_numeric ($v 2)) {$v 2 = floatval ($v 2); $product [$k 1][$k 2] = $v 2;}} if (Is_time ($v 2)) {$product [$k 1][$k 2] = new \mongodate (Strtotime ($v 2));}} Else{foreach ($v 2 as $k 3=> $v 3) {if (!is_array ($v 3) &&!is_object ($v 3)) {if (In_array ($k 3, $productfloat)) {if ( Is_numeric ($v 3)) {$v 3 = floatval ($v 3); $product [$k 1][$k 2][$k 3] = $v 3;}} if (Is_time ($v 3)) {$product [$k 1][$k 2][$k 3] = new \mongodate (Strtotime ($v 3));}} Else{foreach ($v 3 as $k 4=> $v 4) {if (!is_array ($v 4) &&!is_object ($v 4)) {if (In_array ($k 4, $productfloat)) {if ( Is_numeric ($v 4)) {$v 4 = floatval ($v 4); $product [$k 1][$k 2][$k 3][$k 4] = $v 4;}} if (Is_time ($v 4)) {$product [$k 1][$k 2][$k 3][$k 4] = new \mongodate (Strtotime ($v 4));}} Else{foreach ($v 4 as $k 5=> $v 5) {if (!is_array ($v 5) &&!is_object ($v 5)) {if (In_array ($k 5, $productfloat)) {if ( Is_numeric ($v 5)) {$v 5 = floatval ($v 5); $product [$k 1][$k 2][$k 3][$k 4][$k 5] = $v 5;}} if (Is_time ($v 5)) {$product [$k 1][$k 2][$k 3][$k 4][$k 5] = new \mongodate (Strtotime ($v 5));}} Else{foreach ($v 5 as $k 6=> $v 6) {if (!is_array ($v 6) &&!is_object ($v 6)) {if (In_array ($k 6, $productfloat)) {if ( Is_numeric ($v 6)) {$v 6 = floatval ($v 6); $product [$k 1][$k 2][$k 3][$k 4][$k 5][$k 6] = $v 6;}} if (Is_time ($v 6)) {$product [$k 1][$k 2][$k 3][$k 4][$k 5][$k 6] = new \mongodate (Strtotime ($v 6));}} Else{}}}}}}}}}}}}return $product;}
MongoDB-front-end form pass data, data format processing functions in save and fetch-non-recursive