is it possible to integerate java and php

前端 未结 3 1405
南旧
南旧 2021-01-21 20:35

i need to integrate an java class to php program is it possible.??if so please explain???

3条回答
  •  离开以前
    2021-01-21 20:51

    Yes. It is possible. Please refer to the Manual on PHP/Java Integration

    Example

    // get instance of Java class java.lang.System in PHP
    $system = new Java('java.lang.System');
    
    // demonstrate property access
    echo 'Java version=' . $system->getProperty('java.version') . '
    '; echo 'Java vendor=' . $system->getProperty('java.vendor') . '
    '; echo 'OS=' . $system->getProperty('os.name') . ' ' . $system->getProperty('os.version') . ' on ' . $system->getProperty('os.arch') . '
    '; // java.util.Date example $formatter = new Java('java.text.SimpleDateFormat', "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); echo $formatter->format(new Java('java.util.Date'));

提交回复
热议问题