是否可以从本地加载Php文件
我在主捆绑资源路径中有PHP文件。我需要从我的UIViewcontoller调用该文件。但文件并没有被调用 代码:是否可以从本地加载Php文件,php,iphone,uiwebview,Php,Iphone,Uiwebview,我在主捆绑资源路径中有PHP文件。我需要从我的UIViewcontoller调用该文件。但文件并没有被调用 代码: 由于PHP是一种服务器端语言,您将无法像这样运行它,除非您的设备中运行了PHP_server_for_iOS 对不起,我不知道是否存在这样的PHP发行版 致以最良好的祝愿 NSString *pathToBundle = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:p
由于PHP是一种服务器端语言,您将无法像这样运行它,除非您的设备中运行了PHP_server_for_iOS 对不起,我不知道是否存在这样的PHP发行版 致以最良好的祝愿
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];