Is there any way I can execute a PHP script from MySQL?
Linux
DELIMITER @@ CREATE TRIGGER Test_Trigger AFTER INSERT ON MyTable FOR EACH ROW BEGIN DECLARE cmd CHAR(255); DECLARE result int(10); SET cmd=CONCAT('/usr/bin/php ', '/home/test/beta/demo.php'); SET result = sys_exec(cmd); END; @@ DELIMITER ;
Invoking a PHP script from a mysql trigger
Windows
DELIMITER $$ CREATE PROCEDURE udfwrapper_sp (p1 DOUBLE, p2 DOUBLE, p3 BIGINT) BEGIN DECLARE cmd CHAR(255); DECLARE result CHAR(255); SET cmd = CONCAT('C:/xampp/php/php.exe -f "C:/xampp/htdocs/phpFile.php" ', p1, ' ', p2, ' ', p3); SET result = sys_eval(cmd); END$$;[PHP] 利用 mysqli 建立 MySQL Trigger
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。