I have PHP file in main bundle resource path. I need to invoke that file from my UIViewcontoller. But file is not invoking.
code:
NSString *pathToBundle = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:pathToBundle];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"nav" ofType:@"php"];
NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
//CGRect fullScreenRect=[[UIScreen mainScreen]applicationFrame];
web=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
[web loadHTMLString:htmlString baseURL:baseURL];
Since PHP is a server-side language, you will not be able to run it like that, unless you have a PHP_Server_for_iOS running in your device.
I do not know if any such PHP distribution even exists, sorry.
Best wishes,