我想知道是否可以在 Spring MVC 页面中内联编写 PHP 代码。
有点像
<html xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tiles="http://tiles.apache.org/tags-tiles"
xmlns:spring="http://www.springframework.org/tags"
xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" >
<jsp:output doctype-root-element="HTML" doctype-system="about:legacy-compat" />
<jsp:directive.page contentType="text/html;charset=UTF-8" />
<jsp:directive.page pageEncoding="UTF-8" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title><tiles:insertAttribute name="title"/></title>
<util:load-scripts />
<spring:message code="application_name" var="app_name" />
</head>
<body style="background-image: url(${resources}/images/Main_bg.jpg);">
<div id="wrapper">
<lang:PHP>
require_once(somephpfile.php);
...
我有大量遗留 PHP 代码,我想将其集成到我正在构建的更大系统中,新系统是用 Spring 和 Spring MVC 编写的。
最佳答案
是的,你可以。例如,通过使用 Quercus 在 JVM 中运行 php并且您可能需要编写某种自定义标记。
关于java - 将 Spring MVC 与内联 PHP 混合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7068681/