PHP_Handler class
class PHP_Handler extends extHandler { PHP_Handler() { // PHP has been initialized } static RegExp PHP_REGEX = new RegExp(r"/\.php$/i"); String get Name=>"PHP"; static const String phpPath = "php"; static Directory path = Directory.current; static String getMyPath() => "${(path.path)}/packages/ptwebserver/resource"; static bool exists = false; bool test(String file) { return file.toLowerCase().endsWith(".php"); } void handle(ptHost host,HttpRequest req,String file) { List<String> args = new List<String>(); args.add("-n"); args.add("${getMyPath()}/phpExecute.php"); args.add(file); args.add(req.method); req.uri.queryParameters.forEach((key,val) { args.add("${key}=${val}"); }); Process.start(phpPath, args).then((Process proc) { proc.stdout.transform(new Utf8Decoder()).listen((data) { req.response.write(data); }, onDone: () { req.response.close(); }); }); } }
Extends
extHandler > PHP_Handler
Static Properties
Static Methods
Constructors
Methods
void handle(ptHost host, HttpRequest req, String file) #
void handle(ptHost host,HttpRequest req,String file) { List<String> args = new List<String>(); args.add("-n"); args.add("${getMyPath()}/phpExecute.php"); args.add(file); args.add(req.method); req.uri.queryParameters.forEach((key,val) { args.add("${key}=${val}"); }); Process.start(phpPath, args).then((Process proc) { proc.stdout.transform(new Utf8Decoder()).listen((data) { req.response.write(data); }, onDone: () { req.response.close(); }); }); }