PHP-Java-Bridge usage notes, php-java-bridge_PHP tutorial
PHP-Java-Bridge usage notes, php-java-bridge
This is when I was developing Ping An Bank, using PHP environment locally, Ping An Bank interface is Java interface When using PHP-Java-Bridge, call the interface notes. Because the tutorials on the Internet are basically no longer available, I will post here the latest version (2014-09-19) that I can use. If there is any error, please contact me by email. Thank you.
/**============================================================
* @author ken(695093513@qq.com)
* @date 2014-09-09
*
==============================================================**/
/**================================================== ==========
* Version and Environment
*
========================== ====================================**/
Version:
1. PHP version: up to 5.4, current test is 5.4/5.3
2. JDK: The latest official version, the current test is 1.8
3. php-java-bridge: The official latest version, the current test is 6.2.1
4. Operating system: Windows7 32-bit/64-bit | Linux (Centos6. 5)
/**================================================== ==========
* Installation and use
*
========================== ====================================**/
Step 1: Installation
1. JDK installation: Just install it normally and configure the environment variables
2. PHP installation: Normal Install it
3. Installation of php-java-bridge:
① First download the Java server Tomcat and install it normally. After installation, open the Tomcat server
② Put the downloaded php-java-bridge package into Under webapps
③ Wait for Tomcat to execute the parsing, and a folder with the same name will be generated under the directory
④ Copy the folder to the Apache server for use
(Note: The online tutorial can be used normally, call java system functions and simple jar packages, but you will encounter various problems with complex jar packages, so it is recommended to use this method)
Step 2: Use
1. There is no need to open Tomcat ( It is best to turn it off), open the apache server, double-click to run javabridge.jar, and select port 8080 (javabridge.jar also needs to be placed under the java virtual machine, see the second rule below).
2. Place the jar package under the java virtual machine as much as possible, that is, under the jre installation (for example: C:Program FilesJavajre1.8.0_20libext)
3. There is no need to reference the jar package in the PHP file, because Put it under the virtual machine, and java will automatically call
(Note: the javabridge.jar in point 1 is obtained in step 3 of the first step: installation)
/**================================================== ==========
* Other usage methods and precautions
*
======================== =======================================* */
About the use of various functions of PHP-Java-Bridge:
1. The higher version of java_require is no longer used and cannot be used. Since it is placed under the java virtual machine, there is no need to manually introduce the package file.
2. java_value() is used to obtain the value, and this function must be used to obtain the value
(Special note: If the value needs to be stored in the database, the java_value function must be used, otherwise an error will be reported or the value cannot be stored. Database)
3. java_inspect() performs print_r-like output on instantiations or methods
(Note: Please do not directly use output methods such as var_dump to output java classes, methods, and variables. You need to use java_inspect or java_value. For example: var_dump(java_inspect($abc)))
4. For instantiation, use $test = new Java("Test"). If there are parameters in the instantiation method, you can use new Java("Test", "pram")
Notes:
1. Be sure to reference java.inc and make sure the reference is correct
2. Be sure to place the jar package where it can be referenced, such as under the java virtual machine jre
3. Call Java in PHP using the writing method of PHP
/**================================================== ==========
* Appendix 1: Handling various error reports
* Appendix 2: PHP example code
* Appendix 3: Directory map after decompressing the PHP-Java-bridge file package
*
============================================== ===================**/
Appendix 1: Handling various error reporting issues
1. Refer to the "Other uses" above "Methods and Precautions", most of the problems are path reference problems. As long as they are handled properly and obtained correctly, there will be no problems
Appendix 2: PHP example code
require_once("/java/Java.inc"); $util = new Java("com.sdb.payclient.core.PayclientInterfaceUtil"); $input = new Java("com.ecc.emp.data.KeyedCollection"); $signDataput = new Java("com.ecc.emp.data.KeyedCollection"); $input->put("masterId","111111"); $input->put("orderId","222222"); $signDataput = $util->getSignData($input); $orig = java_values($signDataput->getDataValue("orig")); $sign = $signDataput->getDataValue("sign"); echo java_values($sign);
Appendix 3: Directory map after decompression of the PHP-Java-bridge file package
bridge --java java.inc JavaProxy.php --WEB-INF --cgi --... --lib php-script.jar php-servlet.jar --pear web.xml weblogic.xml

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Magnet link is a link method for downloading resources, which is more convenient and efficient than traditional download methods. Magnet links allow you to download resources in a peer-to-peer manner without relying on an intermediary server. This article will introduce how to use magnet links and what to pay attention to. 1. What is a magnet link? A magnet link is a download method based on the P2P (Peer-to-Peer) protocol. Through magnet links, users can directly connect to the publisher of the resource to complete resource sharing and downloading. Compared with traditional downloading methods, magnetic

How to use mdf files and mds files With the continuous advancement of computer technology, we can store and share data in a variety of ways. In the field of digital media, we often encounter some special file formats. In this article, we will discuss a common file format - mdf and mds files, and introduce how to use them. First, we need to understand the meaning of mdf files and mds files. mdf is the extension of the CD/DVD image file, and the mds file is the metadata file of the mdf file.

How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

foobar2000 is a software that can listen to music resources at any time. It brings you all kinds of music with lossless sound quality. The enhanced version of the music player allows you to get a more comprehensive and comfortable music experience. Its design concept is to play the advanced audio on the computer The device is transplanted to mobile phones to provide a more convenient and efficient music playback experience. The interface design is simple, clear and easy to use. It adopts a minimalist design style without too many decorations and cumbersome operations to get started quickly. It also supports a variety of skins and Theme, personalize settings according to your own preferences, and create an exclusive music player that supports the playback of multiple audio formats. It also supports the audio gain function to adjust the volume according to your own hearing conditions to avoid hearing damage caused by excessive volume. Next, let me help you

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

Cloud storage has become an indispensable part of our daily life and work nowadays. As one of the leading cloud storage services in China, Baidu Netdisk has won the favor of a large number of users with its powerful storage functions, efficient transmission speed and convenient operation experience. And whether you want to back up important files, share information, watch videos online, or listen to music, Baidu Cloud Disk can meet your needs. However, many users may not understand the specific use method of Baidu Netdisk app, so this tutorial will introduce in detail how to use Baidu Netdisk app. Users who are still confused can follow this article to learn more. ! How to use Baidu Cloud Network Disk: 1. Installation First, when downloading and installing Baidu Cloud software, please select the custom installation option.

NetEase Mailbox, as an email address widely used by Chinese netizens, has always won the trust of users with its stable and efficient services. NetEase Mailbox Master is an email software specially created for mobile phone users. It greatly simplifies the process of sending and receiving emails and makes our email processing more convenient. So how to use NetEase Mailbox Master, and what specific functions it has. Below, the editor of this site will give you a detailed introduction, hoping to help you! First, you can search and download the NetEase Mailbox Master app in the mobile app store. Search for "NetEase Mailbox Master" in App Store or Baidu Mobile Assistant, and then follow the prompts to install it. After the download and installation is completed, we open the NetEase email account and log in. The login interface is as shown below
