{
"status" : "success",
"prices" : [
{
"market_hash_name" : "AK-47 | Aquamarine Revenge (Battle-Scarred)",
"price" : "9.77",
"created_at" : 1463806291
},
{
"market_hash_name" : "AK-47 | Aquamarine Revenge (Factory New)",
"price" : "38.51",
"created_at" : 1463822081
},
{
"market_hash_name" : "AK-47 | Aquamarine Revenge (Field-Tested)",
"price" : "17.8",
"created_at" : 1463811694
},
{
"market_hash_name" : "AK-47 | Aquamarine Revenge (Minimal Wear)",
"price" : "26.0",
"created_at" : 1463823062
},
{
"market_hash_name" : "AK-47 | Aquamarine Revenge (Well-Worn)",
"price" : "12.9",
"created_at" : 1463832713
},
{
"market_hash_name" : "AK-47 | Black Laminate (Battle-Scarred)",
"price" : "6.36",
"created_at" : 1463832092
},
{
"market_hash_name" : "AK-47 | Black Laminate (Factory New)",
"price" : "93.0",
"created_at" : 1463800517
},
]
}
価格はループし、AK-47のpreg_matchをループすると次の問題が発生します。それはように見えるdoes notのブラックラミネート(ファクトリーニュー)は、すべての種類のhtmlタグを含む文字列を検索するPHP
アイブ氏は
$data = json_decode($json,true);
$prices = $data['prices'];
echo '<pre>';
$item = 'AK-47 | Black Laminate (Factory New)';
foreach($prices as $items){
foreach($items as $key=>$value){
if(preg_match("/".$item."/i",$value)){
echo $key."<br>";
echo $value."<br>";
}
}
}
echo '</pre>';
任意のアイデアアイブが
をプログラム変数$項目にそれらの/を追加する方法はありますか? – user3280648
@ user3280648はい 'preg_quote'を使用してください – zhilevan