开发者

How Do I expose CFPropertyList for IPhone application from CodeIgniter

Is there any possibility to e开发者_C百科xpose CFPropertyList for IPhone application from CodeIgniter website. I googled the examples and tutorials but I did not find any relevant information.

Simply I want to do the following.

  1. I will call a URL from my Iphone application of the Codeigniter website by passing some query strings

  2. and my php page will fetch the data from my MySql database.

  3. finally it would echo the result in Plist for Iphone application

Thanks for your help!!


Maybe this can help:

The PHP implementation of Apple's PropertyList can handle XML PropertyLists as well as binary PropertyLists. It offers functionality to easily convert data between worlds, e.g. recalculating timestamps from unix epoch to apple epoch and vice versa. A feature to automagically create (guess) the plist structure from a normal PHP data structure will help you dump your data to plist in no time.

https://github.com/rodneyrehm/CFPropertyList

I Haven't actually used this.


I use CFPropertyList all the time in my CI apps. The trick is to not use the CI library load method.It will always throw an error because CodeIgniter does not yet support Namespaces (likely why so many people are moving to Laravel), and the CFPropertyList library uses Namespaces.

Here is a example showing how to use CFPropertyList within a CI function:

public function getRecord($id){

    require_once(__DIR__.'/../libraries/CFPropertyList/CFPropertyList.php');

    $plistfile = ASSET_ROOT . 'uploads/fashion/FasionItems.plist';
    $content = file_get_contents($plistfile);

    /* notice use of the \ character */
    $plist = new CFPropertyList\CFPropertyList();

    $plist->parse($content);
    $plistarray = $plist->toArray();


    foreach($plistarray['Episodes'] AS $key => $record){

        if($record['ItemId'] == $id){  

            return $record;
            break;

        }

    }

    return FALSE;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜