JavaScript中使用PHP, 超好用的php.js, PHP extensions in JavaScript, phpjs

PHP extensions in JavaScript

项目地址:https://github.com/kvz/locutus

 

直接下载:php.js

 

npm 安装

npm install locutus

Use

vim index.js
var sprintf = require('locutus/php/strings/sprintf')
var echo = require('locutus/php/strings/echo')
var effectiveness = 'futile'
echo(sprintf('Resistance is %s', effectiveness))
var strings = require('locutus/golang/strings')
console.log(strings.Contains('Locutus', 'cut'))
$ node index.js
Resistance is futile
true

 

array

bc

ctype

datetime

exec

filesystem

funchand

i18n

info

json

math

misc

net-gopher

network

pcre

strings

url

var

xdiff

xml

 

本文:JavaScript中使用PHP, 超好用的php.js, PHP extensions in JavaScript