0
シンプルだろうが、それは正しくできない。テスト::プライベート私は必要な文字列がmaincurrencyから「GBP」ですPHP:配列から値を取得する
foreach($_SESSION['cart'] as $category => $thing) {
echo $category; //echo's config |the value I need GBP
echo $thing; // echo's Array
if ($category == 'maincurrency:cart:private')
{
echo 'found_it'; //doesn't echo
echo $category; //echo's nothing |the value I need GBP
echo $thing; // echo's nothing
}
}
:
print_r($_SESSION); //gives:
Array
(
[cart] => cart Object
(
[config] => Array()
[maincurrency:cart:private] => GBP
)
)
コード今のところ私は、セッション配列のうち値がここでどのようにそのビルドのニーズ。
だ得るためにそれを使用するには、$を行いますカテゴリecho 'maincurrency:Test:private'? – bozdoz
カテゴリ - > GBPを試しましたか? – CountMurphy
あなたは削除すべきif文の最後にセミコロンがあります(これは実際のコードではなく、投稿内にあると確信しています)。 –