简体   繁体   中英

Parse PHP array in ASP.NET web service?

For a web service having this structure in PHP:

function getAlbums($quantity) 
    {

       /* this is a sample array */

        $albums=array();
        $albums[0]['title']='Stripped';
        $albums[0]['artist']='Christina Aguilera';
        $albums[0]['genre']='Pop';
        $albums[0]['songs'][0]='Beautiful';
        $albums[0]['songs'][1]='Fighter';

        $return=array();
        for($i=0;$i<=$quantity;$i++){

           $return[$i]=$albums[$i]; 

        }

        return $return;

    }

I have it displaying fine in my browser with a PHP client, but now how do I parse it in ASP.NET to show the data?

Thank you.

I wonder why/how you are clubbing PHP and ASP.net. But when you want to exchange data between two different systems you can convert it into an intermediate format that both understands. In any such situation you can convert your data into JSON and read that data from ASP.net. By doing this, you can convert your PHP array into an array ASp.net. Hope this helps...

The two things are completely opposite: they both are different language. You need something inn the middle between them. Preferably a database, at worse some kind of file system...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM