원격 XML 파일을 가져 와서 제품 데이터가있는 테이블을 표시하는 스크립트가 있습니다. 데이터 형식은 다음과 같습니다 MySQL 데이터베이스없이 배열만을 사용하여 결과를 표시하는 방법
ID, name, price, months.
+++++++++++++++++++
1, Name1, $24, 12
2, Name2, $11, 24
2, Name2, $10, 36
3, Name3, $16, 12
2, Name2, $9, 48
4, Name4, $26, 12
+++++++++++++++++++
당신이 ID 2 Name2
를 참조로
나는
가아무도 나를위한 몇 가지 PHP 함수를 작성 도와 드릴까요 한 번만 동일한 제품 이름을 표시하고 달의 선택과 그것을위한 드롭 다운 메뉴가 있습니다 (그래서 가격이 해당 메뉴의 값으로 이동합니다) 필요 그것? 그것은 MySQL 데이터베이스, 어쩌면 PHP 배열을 사용해서는 안됩니다 ...
대단히 고마워요! 귀하의 관심
++++++++++++++++++++++++++++++++++++
정말 고마워요 , 정말로 이것을 감상! 월)의 투 론강 (Turon에 의해 기능이 해결책으로 보이지만, 내가 그것을 구현하는 문제가 .. 여기 내 실제 코드입니다 :
<?
try
{
$client = new soapclient("https://api.thesslstore.com/WBService.svc?wsdl", array('trace' => 1,'soap_version' => SOAP_1_1));
$parameters = array('objAuth'=>array("ResellerUserName"=>"[email protected]","ResellerPassword"=>"password","PartnerCode"=>000000111));
// get the result, a native PHP type, such as an array or string
$result = $client->GetAllProductPrice($parameters);
$counter=count($result->GetAllProductPriceResult->AllProductPrice->AllProductPricing);
for ($i=0; $i<$counter; $i+=1) {
printf("<tr><td> %s \n", $result->GetAllProductPriceResult->AllProductPrice->AllProductPricing[$i]->NumberOfMonths ."</td>");
printf("<td> %s \n", $result->GetAllProductPriceResult->AllProductPrice->AllProductPricing[$i]->Price ."</td>");
printf("<td> %s \n", $result->GetAllProductPriceResult->AllProductPrice->AllProductPricing[$i]->ProductCode ."</td>");
printf("<td> %s \n", $result->GetAllProductPriceResult->AllProductPrice->AllProductPricing[$i]->ProductName ."</td>");
}
catch (Exception $e)
{
printf("Error:sendSms: %s\n",$e->__toString());
}
exit;
?>
을 그리고 여기에 라이브 예제 : 당신의 도움에 대한 http://webservice.ge/eus/TestPHPAPIProductDetails.php
감사합니다!
ID의 전체적인 점은 고유하다는 것입니다. 복제했을 때 그 점을 다소 죽였을 것입니다. 절대 일어나서는 안됩니다. –
XML 문서의 예를 들려 줄 수 있습니까? (CSV가 아닌 실제 Dom 트리) – Tomas