4D PHP
Description
PHP (Hypertext Preprocessor) is a server-side scripting language designed primarily for web development. This component provides a class-based generic API with callback functions to use PHP from 4D as a one-shot command, a local FastCGI server (PHP Execute), or as an interactive worker process.
README
- the source code of this component is licensed under the MIT license.
- see php.net for the licensing of PHP.
php
Use PHP as one-shot CLI, FastCGI, or interactive worker process.
Usage
$CGI:=cs.PHP.PHP_CGI.new(cs.PHP._PHP_CGI_Controller).cgi()
$php:="<?php\n\nfunction sum(int $a, int $b): int {\nreturn $a + $b;\n}\n"
$phpFile:=Folder(fk desktop folder).file("test.php")
$phpFile.setText($php)
var $returnValue : Text
If (PHP Execute($phpFile.platformPath; "sum"; $returnValue; 5; 3))
ALERT($returnValue)
End ifto test CGI mode
#DECLARE($params : Object)
If (Count parameters=0)
CALL WORKER(1; Current method name; {})
Else
$form:=cs.PHP.CGI_PHPForm.new()
End ifto test interactive
#DECLARE($params : Object)
If (Count parameters=0)
CALL WORKER(1; Current method name; {})
Else
$form:=cs.PHP.Interactive_PHPForm.new()
End ifto test one-shot
#DECLARE($params : Object)
If (Count parameters=0)
CALL WORKER(1; Current method name; {})
Else
$form:=cs.PHP.Run_PHPForm.new()
End if