首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >来自变量的html标记不显示在php中。

来自变量的html标记不显示在php中。
EN

Stack Overflow用户
提问于 2013-07-28 21:19:42
回答 1查看 125关注 0票数 0

我将这个web服务调用到我的curl文件中,并且响应是用XML表示的。现在,当我在浏览中预览时,它不显示Google地图,而是显示html标记。

代码语言:javascript
运行
复制
$data= "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ser='http://services.webservices.vub.com/'>
           <soapenv:Header/>
           <soapenv:Body>
              <ser:googlemap>
                 <!--Optional:-->
                 <address>ijzerenmolenstraat, leuven Belgium</address>
              </ser:googlemap>
           </soapenv:Body>
        </soapenv:Envelope>";
$url="http://localhost:8080/Venue_Finder_Soap_Version_/VenueFinder?WSDL";
$response=curl_soappost_call($url,$data);
echo "<pre>";
print_r($response);
echo " </pre>";

输出:所有html标记

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-29 13:26:19

我将使用jquery将内容添加到DOM中。这样,新的HTML、JS和CSS将得到正确的呈现/执行。尝试以下几点:

页面正文部分中的

在页面上放置一个具有唯一id属性的空div,您希望在其中显示内容,例如:

代码语言:javascript
运行
复制
 <div="the_google_map"></div>

在页面的头部分:

代码语言:javascript
运行
复制
 // include the jquery library (Can be downloaded and hosted on your own server if desired)
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

 $(document).ready(function(){  // don't run this code until the DOM is ready

    //  get the content  
    $data= "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ser='http://services.webservices.vub.com/'>
               <soapenv:Header/>
               <soapenv:Body>
                  <ser:googlemap>
                     <!--Optional:-->
                     <address>ijzerenmolenstraat, leuven Belgium</address>
                  </ser:googlemap>
               </soapenv:Body>
            </soapenv:Envelope>";
    $url="http://localhost:8080/Venue_Finder_Soap_Version_/VenueFinder?WSDL";
    $response=curl_soappost_call($url,$data);

    // use jquery to insert the content into the DOM
    // Note the div id value here matches the div id used in the body
    $('#the_google_map').append($response);


 });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17913006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档