is it possible to integerate java and php

前端 未结 3 1402
南旧
南旧 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:41

    I think it is possible. Check this : PHP to Java bridge

    0 讨论(0)
  • 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') . '<br />';
    echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />';
    echo 'OS=' . $system->getProperty('os.name') . ' ' .
                 $system->getProperty('os.version') . ' on ' .
                 $system->getProperty('os.arch') . ' <br />';
    
    // 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'));
    
    0 讨论(0)
  • 2021-01-21 21:00
    • You can Start a java application as any other application from PHP using exec.
    • You can interop using WebServices
    0 讨论(0)
提交回复
热议问题