質問

For example, i have java class JRXlsExporter, if i instantiated that java from java my code is :

    JRXlsExporter myObject= new JRXlsExporter();

and from PHP become:

    $myObject = new Java("net.sf.jasperreports.engine.export.JRXlsExporter");

It works, but if i have java class with parameter, for example :

    JRXlsExporter myObject= new JRXlsExporter(param1,param2);

How to instantiate/call that java class from PHP ?

役に立ちましたか?

解決

Here is an example of how java.util.Date object is instantiated, with some constructor arguments:

$date = new Java("java.util.Date", 70, 9, 4);

Further, it says:

The new Java("java.util.Date", 70, 9, 4) call creates a new instance of the java.util.Date class using the java.util.Date(int year, int month, int day) constructor.

So, you could maybe try this:

$myObject = new Java("net.sf.jasperreports.engine.export.JRXlsExporter", param1, param2);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top