简体   繁体   English

发送从另一台服务器调用函数的请求

[英]Send a request to call a function from another server

I have client code in php and two servers eg apache and tomcat. 我在php和两个服务器(例如apache和tomcat)中有客户端代码。 I want to call a method in tomcat server through apache. 我想通过apache在tomcat服务器中调用方法。 Whereas apache is running in 81 port and tomcat is running in 85 port. 而apache在81端口中运行,而tomcat在85端口中运行。 the function which should be called is in javascript(in tomcat) . 应该调用的函数在javascript(tomcat)中。 what is the php code to do this? 什么是PHP代码做到这一点?

Am new to this please help me with explanation. 这是新手,请帮我解释。

Maybe you can do something like that: 也许您可以执行以下操作:

<script src="yourscript.php" type="text/javascript"></script>

where 'yourscript.php' is: 其中“ yourscript.php”为:

<?php
header('Content-Type: application/javascript');
echo file_get_contents("http://yourtomcat:85/yourjsfile.js");
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM