java调用php方法参数,如何使用PHP中的参数实例化/调用java类?

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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值