2016-06-10 3 views
0

저는 PHP 서비스를 만들고, Vertrigo에서 로컬로 작업 한 다음 IBM Bluemix에 업로드하는 프로젝트를 진행하고 있습니다.bluemix에서 PHP 코드 작동을 시도했습니다.

코드는 로컬에서 잘 작동하는 것처럼 보이지만 Bluemix에서 코드를 찾아 내려고 시도 할 때 오류가 발생합니다.

프로젝트는 index.html, client.phpserver.php의 세 파일로 구성됩니다. 문제는 client.phpserver.php 사이에 있습니다. server.php에 정의 된 함수를 client.php에서 호출하려고하면 해당 함수를 호출 한 행을 건너 뛰고 나머지는 계속 실행합니다.

이것은 client.php 코드의 일부이다

<?php 
    if(isset($_POST['saludo']) && !empty($_POST['nombre']) && !empty($_POST['apellido'])) { 
     require_once ('nusoap.php'); 

     $soapclient = new soapclient('server.php'); 
     $resultado = $soapclient->call('funcionsaludo',array('nombre'=>$_POST['nombre'],'apellido'=>$_POST['apellido'])); 

     $html = <<<html 
      <html> 
      <head></head> 
      <title>Saludando...</title> 
      <body bgcolor = "#9d1fc4" text = "black"><center><img src = "/images/3.jpg"></center><br><br> 
      <center><b>$resultado<br><br><a href='index.html' style='color: #ffffff'>INICIO</a></b></center> 
      </body> 
      </html> 
     html; 

     echo $html; 
    } 

스킵되는 부분은 어디 이루어진다 파일 server.php 호출 : 마지막

$soapclient = new soapclient('server.php'); 
$resultado = $soapclient->call('funcionsaludo',array('nombre'=>$_POST['nombre'],'apellido'=>$_POST['apellido'])); 

, server.php 파일의 일부를 보여줍니다.

<?php 
    require_once('nusoap.php'); 

    $server = new soap_server; 
    $server->register('funcionsaludo'); 
    $server->register('getData'); 
    $server->register('insertData'); 

    function funcionsaludo ($nombre,$apellido) { 
     return "<html><head></head><body>Hola $nombre $apellido<br><br></body></html>"; 
    } 

결과적으로 다음과 같은 기능이 있습니다. funcionsaludo은 "Hola $ nombre $ apellido"로 구성된 문자열을 반환하지만 문자열이 화면에 표시되지 않기 때문에 건너 뛴 것처럼 보입니다.

나는 또한 추가 할 모든 3 개 개의 파일 index.html, client.php, server.php 모든 IBM Bluemix 개발 운영 서비스 내부의 기본 프로젝트 폴더에 업로드 된 nusoap.php이다 사용되는 라이브러리 및 서로 다른 폴더에 아니에요 또는 그런 것. 또한 로그에 일부 표시등이 표시 될 수있는 오류 메시지가 표시되지 않습니다.

server.php 파일의 해당 기능을 건너 뛰는 이유에 대해 도움을 주신 데 대해 감사드립니다. 고맙습니다 !

답변

0

글쎄, 당신의 HTML 변수에 몇 태그를 가지고 있지만, PHP에 대한이 같은/작은 따옴표를 두 배로해야 텍스트로 해석 :

$html = '<html> 
      <head></head> 
      <title>Saludando...</title> 
      <body bgcolor = "#9d1fc4" text = "black"><center><img src = "/images/3.jpg"></center><br><br> 
      <center><b>$resultado<br><br><a href="index.html" style="color: #ffffff">INICIO</a></b></center> 
      </body> 
      </html>'; 

     echo $html; 

그렇지 않으면 PHP 방법으로 해석하는 것 기능, 그리고 존재하지 않습니다. 이 기능을 변경하고 다시 시도해보십시오. 작동하지 않으면 브라우저에서 개발자 도구를 열고 전혀 렌더링되지 않았는지 확인하십시오 (예 : HTML 페이지 구조).

+0

죄송합니다. 게시 한대로 작은 따옴표를 사용하면 변수를 연결해야합니다. 연결하지 않으려면 큰 따옴표를 사용해야하지만 HTML 태그의 태그를 이스케이프 처리해야합니다. –

관련 문제