PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : JSP-sript in PHP umwandeln


holger1306
16.06.2007, 17:26:03
Angeblich ist es ganz einfach, folgendes jsp-script in php umzuwandeln. Von jsp hab in null Ahnung. Kann das hier jemand ?

<body>
<p>Hello world. Welcome to our XHTML MP tutorial.</p>
</body>
</html>
<%
String acceptHeader = request.getHeader("accept");

if (acceptHeader.indexOf("application/vnd.wap.xhtml+xml") != -1)
response.setContentType("application/vnd.wap.xhtml+xml");
else if (acceptHeader.indexOf("application/xhtml+xml") != -1)
response.setContentType("application/xhtml+xml");
else
response.setContentType("text/html");
%>

Eskayp
07.09.2007, 08:45:09
Weiß nicht, ob das noch interessant für Dich ist, Deine Anfrage ist ja schon 'ne Weile her. Aber ich würd' sagen so:

<?php
$acceptHeader = $_SERVER['HTTP_ACCEPT'];
if (strpos($acceptHeader, "application/vnd.wap.xhtml+xml") !== false)
header('Content-type: application/vnd.wap.xhtml+xml');
else if (strpos($acceptHeader, "application/xhtml+xml") !== false)
header('Content-type: application/xhtml+xml');
else
header('Content-type: text/html');
?>
<body>
<p>Hello world. Welcome to our XHTML MP tutorial.</p>
</body>
</html>