Reputation:
I am trying to display a local web page in a UIWebView
. The local web page is a PHP
file and stored in the Supporting Files folder then a folder I created called webpages. I tried this code but it doesn't work.
@synthesize web;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"php" inDirectory:@"web"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[web loadRequest:request];
[web setDelegate:self];
[web loadRequest:request];
}
Upvotes: 0
Views: 901
Reputation: 1316
You can't run a local php file through UIWebView. PHP is a server side scripting language. OS X (and Windows) don't know how to interpret php code.
It seems to be an iPhone app your making, and running local php in your iPhone app is a no-go, and will continue to be for the foreseeable future.
Upvotes: 0
Reputation: 1544
You can not load PHP
file in UIWebView
, Because PHP
needs server to run.
Upvotes: 1