[英]Is it possible to load Php file from local
I have PHP file in main bundle resource path. 我在主捆绑包资源路径中有PHP文件。 I need to invoke that file from my UIViewcontoller.
我需要从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. 由于PHP是一种服务器端语言,因此除非您的设备中运行着PHP_Server_for_iOS,否则您将无法像这样运行它。
I do not know if any such PHP distribution even exists, sorry. 我不知道是否存在任何这样的PHP发行版,对不起。
Best wishes, 最好的祝愿,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.