PHP4 calls JavaBean's exploration (continued)
Written "PHP4 call Javabean's exploration", then I want to try the Javabean written by yourself, how can you not teach a lot, I finally understand, here I want to thank Liao Yang, in fact, I am not familiar with him. However, he did give me a lot of help. Declare that the following examples are implemented under Win2000 / IIS5 / CGI / PHP4DEV2 / JDK13. Below I add a few simple examples in the previous article. Supplement: Next good PHP4 version, I have always liked the PHP4 version under http://www.mm4.de/. After downloading, it took a php.ini and has supported Java. You add your own Java Class directory in java.class.path, such as: f: php4class, you will do your own Java Class. With its "root" (Package with Java, it is built here), and some simple example shows great "Hello World!" To write a simple Java file (I am using Liao Yang here. Example, in order to express your gratitude, I didn't do any changes) Test1.java files as follows: package tests; public class test1 {public string getMessage () {return "Hello World";}} Generate Test1.class files with Javac Test1.java In the Test1.class copy to f: php4class's Tests subdirectory (here is the need of Java Package), getMsg.php4 files are as follows: $ B = new java ("tests.test1"); $ x = $ b-> getMessage (); echo $ x;> Accessing getMsg.php4 in the browser will display "Hello World!" and give an example: Test.java file content is as follows: import java.lang. *; Public class test {public int RET_TEST (INT i) {if (i> 0) RETURN 31; if (i == 0) Return 30; if (i <0) return 29; return 100;}} is compiled after F : PHP4CLASS directory, name is of course: test.class write a php4 file Testint.php4 as follows: $ b = new Java ("TEST", "); $ x = $ b-> RET_TEST (4); Echo $ x;?> Access will display 31. Later, I made a Javabean called the SQL database. Everything in PHP4 is normal. You can try it yourself. It is true. From a certain extent, it can be said that "hidden source code" is achieved. Interested friends are welcome.
Related resources: with sound access new year fireworks animation effects - html-code