嗨,在这行代码之后:
$client = new SoapClient("http://rscnagahrd/OracleWS/Oracle.asmx?WSDL");
$result = $client->getFoods();
$objResult = simplexml_load_string($result->getFoodsResult->any);
我想将标签中的值提取$objResult
到 PHP 变量中。
什么时候I var_dump($objResult);
我得到:
object(SimpleXMLElement)#4 (1) {
["NewDataSet"]=> object(SimpleXMLElement)#5 (1) {
["Table"]=> array(4) {
[0]=> object(SimpleXMLElement)#6 (4) {
["FOOD_ID"]=> string(1) "1"
["FOOD_NAME"]=> string(6) "Burger"
["FOOD_DESC"]=> string(15) "100% Beef Patty"
["FOOD_PRICE"]=> string(2) "25"
}
[1]=> object(SimpleXMLElement)#7 (4) {
["FOOD_ID"]=> string(1) "2"
["FOOD_NAME"]=> string(4) "Coke"
["FOOD_DESC"]=> string(6) "Drinks"
["FOOD_PRICE"]=> string(2) "10"
}
[2]=> object(SimpleXMLElement)#8 (4) {
["FOOD_ID"]=> string(1) "3"
["FOOD_NAME"]=> string(5) "Pepsi"
["FOOD_DESC"]=> string(6) "Drinks"
["FOOD_PRICE"]=> string(2) "10"
}
[3]=> object(SimpleXMLElement)#9 (4) {
["FOOD_ID"]=> string(1) "4"
["FOOD_NAME"]=> string(12) "French Fries"
["FOOD_DESC"]=> string(16) "Made from France"
["FOOD_PRICE"]=> string(2) "15"
}
}
}
}
例如,我想将所有带有 TAG“FOOD_NAME”的项目分配给 PHP 变量
$foodname(0)