Last active
July 12, 2019 06:19
-
-
Save haxianhe/e69be41f9399e21b9b12ae8bbe7e2417 to your computer and use it in GitHub Desktop.
php 过滤数组中有需要的键值对
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function filterArray($oldArray,$keyArray) | |
{ | |
$newArray=array_intersect_key($oldArray, array_flip($keyArray)); | |
return $newArray; | |
} | |
$promotion = array_intersect_key($promotion, array('id', 'promotion_id', 'promotion_actived', 'promotion_title', | |
'promotion_detail', 'promotion_type', 'promotion_type_name', 'sku_info', 'start_time', 'cancel_time','effect_scene')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment