Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以从本地加载Php文件_Php_Iphone_Uiwebview - Fatal编程技术网

是否可以从本地加载Php文件

是否可以从本地加载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文件。我需要从我的UIViewcontoller调用该文件。但文件并没有被调用

代码:


由于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];