A new life for hybrids--Java+PHP integration_PHP tutorial
Only recently have I had time to work on this and apply this idea to a real-world application. The following explains how to develop and publish from two aspects.
Example: Explain the java+php development model, taking menu management as an example.
An example is as follows:
1: java structure code
The java development structure diagram is as follows:
For the java program code, please see the uploaded file below. Since the uploaded file cannot be larger than 2M, the lib used is not uploaded. If you need it, please leave your email to me and I will send it to everyone.
Note: PHP and Java each have data types defined within their own languages. When PHP data is transmitted to Java, or Java data is transmitted to PHP, LAJP automatically and accurately converts them internally, and programmers do not need to perform any decoding. Work
2: Java application release
Place the compiled files in the LAJP directory: My file directory: E:lajp-10.05test_serviceecard
As shown below:
三:php 结构代码
class Menu extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->model('system/menu_model');
}
function index(){
$condition = array();
$condition['menu_id'] = $this->uri->segment(4,0);
$condition['path'] = $this->input->post('path');
$condition['start'] = $this->input->post('start');
$condition['id'] = $this->input->post('id');
$condition['order'] = $this->input->post('order');
$condition['isfresh'] = $this->input->post('isfresh');
$condition['visible'] = $this->input->post('visible');
$condition['defaultselect'] = $this->input->post('defaultselect');
$condition['name'] = $this->input->post('name');
$condition['parentid'] = $this->input->post('parent_id');
$condition['numPerPage'] = $this->input->post('numPerPage') ? $this->input->post('numPerPage') : 20;
$condition['orderField'] = $this->input->post('orderField') ? $this->input->post('orderField') : 'SMT_PARENT_ID';
$condition['pageNum'] = $this->input->post('pageNum') ? $this->input->post('pageNum') : 1;
$data = array();
$allmenus = $this->menu_model->getMenus();
$this->load->library('smart_tree');
$options = array(
'index' => 1,
'type' => 0,
'self' => 1,
'hreffromdb' => 0,
'relfromdb' => 0,
'rel' => 'system/menu/index',
'href' => 'system/menu/index/',
'hrefuseid' => 1,
'title' => '菜单管理'
);
$data['allmenus'] = $this->smart_tree->getTrees($allmenus, $options);
$data['menus'] = $this->menu_model->getMenusVoByCondition($condition);
$data['total'] = $this->menu_model->getCount($condition);
$data['condition'] = $condition;
$this->load->view('system/menu/index.phtml', $data);
}
function add(){
$data['menus'] = $this->menu_model->getMenus();
$this->load->view('system/menu/add.phtml',$data);
}
function insert(){
$vo = newObject('ecard_sys_menus_vo_MenusVo');
$vo->name = (string)$this->input->post('name');
$vo->parentid = (int)$this->input->post('parent_id');
$vodefaultselect = (int)$this->input->post('defaultselect');
$vo->visible = (int)$this->input->post('visible');
$vo->isfresh = (int)$this->input->post('isfresh');
$vo->desc = (string)$this->input->post('desc');
$vo->path = (string)$this->input->post('path');
$vo->start = (int)$this->input->post('start');
$vo->order = (int)$this->input->post('order');
$vo->cuser = 1;
if($this->menu_model->insert($vo)){
$reback = array("statusCode"=>"200","message" => "添加成功","navTabId" => "system/menu/index", "callbackType" => "closeCurrent","forwardUrl" => "" );
}else{
$reback = array("statusCode"=>"300","message" => "添加失败","navTabId" => "", "callbackType" => "","forwardUrl" => "" );
}
echo json_encode($reback);
}
function edit(){
$menu_id = $this->uri->segment(4,0) or exit('菜单不存在');
$data['menu'] = $this->menu_model->getMenusVoById($menu_id) or exit('菜单不存在');
$data['pmenu'] = $this->menu_model->getMenusVoById($data['menu']['parentid']) or exit('菜单不存在');
$this->load->view('system/menu/edit.phtml',$data);
}
function update(){
$vo = newObject('ecard_sys_menus_vo_MenusVo');
$vo->id = (int)$this->input->post('id');
$vo->name = (string)$this->input->post('name');
$vo->path = (string)$this->input->post('path');
$vo->parentid = (int)$this->input->post('parent_id');
$vo->order = (int)$this->input->post('order');
$vo->start = (int)$this->input->post('start');
$vo->defaultselect = (int)$this->input->post('defaultselect');
$vo->visible = (int)$this->input->post('visible');
$vo->isfresh = (int)$this->input->post('isfresh');
$vo->desc = (string)$this->input->post('desc');
$vo->uuser = 1;
if($this->menu_model->update($vo)){
$reback = array("statusCode"=>"200","message" => "编辑成功","navTabId" => "system/menu/index", "callbackType" => "closeCurrent","forwardUrl" => "" );
}else{
$reback = array("statusCode"=>"300","message" => "编辑失败","navTabId" => "", "callbackType" => "","forwardUrl" => "" );
}
echo json_encode($reback);
}
function delete(){
$ids = $this->input->post('ids');
if(!$ids){
$ids = $this->uri->segment('4',0) or exit('缺少参数');
}
if($this->menu_model->deletes($ids)){
$reback = array("statusCode"=>"200","message" => "删除成功","navTabId" => "", "callbackType" => "","forwardUrl" => "" );
}else{
$reback = array("statusCode"=>"300","message" => "删除失败","navTabId" => "", "callbackType" => "","forwardUrl" => "" );
}
echo json_encode($reback);
}
function search(){
$data = array();
$data['menus'] = $this->menu_model->getMenus();
$this->load->view('system/menu/search.phtml',$data);
}
function tree(){
$menus = $this->menu_model->getMenus();
$this->load->library('smart_tree');
$data['menus'] = $this->smart_tree->getTrees($menus,array('index'=>1,'type'=>0,'self'=>1,'hreffromdb'=>0));
$this->load->view('system/menu/tree',$data);
}
}
四:应用展现
java程序开发完成后,并将编译后程序发布到lajp文件目录下后,点击E:lajp-10.05下的run-socket.bat 运行程序,如下图所示:
A new life for hybrids--Java+PHP integration_PHP tutorial:
The php interface is shown as follows:
Application interface
This article comes from the blog "Bragging about pulling submarines and pushing trains and planes"

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

AI Hentai Generator
Generate AI Hentai for free.

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



If you encounter the Unable to save changes error while using the Photos app for image editing in Windows 11, this article will provide you with solutions. Unable to save changes. An error occurred while saving. Please try again later. This problem usually occurs due to incorrect permission settings, file corruption, or system failure. So, we’ve done some deep research and compiled some of the most effective troubleshooting steps to help you resolve this issue and ensure you can continue to use the Microsoft Photos app seamlessly on your Windows 11 device. Fix Unable to Save Changes to Photos App Error in Windows 11 Many users have been talking about Microsoft Photos app error on different forums

The Apple Vision Pro headset is not natively compatible with computers, so you must configure it to connect to a Windows computer. Since its launch, Apple Vision Pro has been a hit, and with its cutting-edge features and extensive operability, it's easy to see why. Although you can make some adjustments to it to suit your PC, and its functionality depends heavily on AppleOS, so its functionality will be limited. How do I connect AppleVisionPro to my computer? 1. Verify system requirements You need the latest version of Windows 11 (Custom PCs and Surface devices are not supported) Support 64-bit 2GHZ or faster fast processor High-performance GPU, most

Microsoft Paint not working in Windows 11/10? Well, this seems to be a common problem and we have some great solutions to fix it. Users have been complaining that when trying to use MSPaint, it doesn't work or open. Scrollbars in the app don't work, paste icons don't show up, crashes, etc. Luckily, we've collected some of the most effective troubleshooting methods to help you resolve issues with Microsoft Paint app. Why doesn't Microsoft Paint work? Some possible reasons why MSPaint is not working on Windows 11/10 PC are as follows: The security identifier is corrupted. hung system

1. First, we right-click the blank space of the taskbar and select the [Task Manager] option, or right-click the start logo, and then select the [Task Manager] option. 2. In the opened Task Manager interface, we click the [Services] tab on the far right. 3. In the opened [Service] tab, click the [Open Service] option below. 4. In the [Services] window that opens, right-click the [InternetConnectionSharing(ICS)] service, and then select the [Properties] option. 5. In the properties window that opens, change [Open with] to [Disabled], click [Apply] and then click [OK]. 6. Click the start logo, then click the shutdown button, select [Restart], and complete the computer restart.

On the Douyin platform, many users are eager to obtain level certification, and the level 10 light sign shows the user's influence and recognition on Douyin. This article will delve into the price of Douyin’s level 10 light boards and the time it takes to reach this level to help users better understand the process. 1. How much does a level 10 Douyin light sign cost? The price of Douyin's 10-level light signs will vary depending on market fluctuations and supply and demand. The general price ranges from a few thousand yuan to ten thousand yuan. This price mainly includes the cost of the light sign itself and possible service fees. Users can purchase level 10 light signs through Douyin’s official channels or third-party service agencies, but they should pay attention to legal channels when purchasing to avoid false or fraudulent transactions. 2. How many days does it take to create a level 10 fan sign? Reach level 10 light sign

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

This article will guide you on how to migrate photos from Photos Legacy to the new Photos app in Windows 11. Microsoft has introduced a revamped Photos app in Windows 11, giving users a simpler and more feature-rich experience. The new Photos app sorts photos differently than the past PhotosLegacy app. It organizes photos into folders like other Windows files instead of creating albums. However, users still using the Photos Legacy app can easily migrate their photos to the new version of Microsoft Photos. What is Phot

0xc0000142 refers to the error code in Windows systems, and it is usually related to the problem of a program or application not starting or running properly. When a user tries to open a program, the system displays the error message "0xc0000142" and the program cannot continue to run. So, why does the 0xc0000142 error occur? There are many reasons for this error code, here are some common causes and solutions. Corrupted configuration files: The configuration files of some programs may be corrupted, causing
