Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 795 Bytes

File metadata and controls

42 lines (35 loc) · 795 Bytes

lua-php-utils

PHP-style utility functions for LuaJIT applications

目前支持的php函数(相关函数均从PHP C源码中移植过来),使用方法请参考PHP手册(将不断的增加新PHP函数)

  1. str_pad
  2. genid 获取一个唯一的ID
  3. trim
  4. rtrim
  5. ltrim
  6. split
  7. strncmp
  8. explode
  9. hash(key, seed)
  10. ip2long
  11. long2ip
  12. ctype_upper
  13. ctype_lower
  14. ctype_alpha
  15. ctype_alnum
  16. ctype_lower
  17. ctype_digit
  18. addslashes
  19. stripslashesa
  20. xxtea_decrypt
  21. xxtea_encrypt

编译方法

gcc -O3 -shared -fPIC -I/usr/local/include/luajit-2.0/   -c -o php.o php.c
gcc -O3 -shared -fPIC -I/usr/local/include/luajit-2.0/ -ansi -pedantic -Wall -o php.so php.o

运行例子程序

luajit-2.0.2 test.lua