결제기능 제작중인데 자꾸 막히네요;;
파이썬 플라스크와 php 를 사용해서 결제기능과 홈페이지를 제작중인데 자꾸 막히네요.
php 는 딱히 건든거 없고 플라스크로 이렇게 열고 있는데 자꾸만 오류가 나네요
@app.route('/success.php', methods=['GET'])
def display_php_file():
# GET 매개변수에서 필요한 값을 가져옵니다.
paymentType = request.args.get('paymentType')
orderId = request.args.get('orderId')
paymentKey = request.args.get('paymentKey')
amount = request.args.get('amount')
# PHP 파일 경로
php_file_path = 'templates/php/success.php'
# PHP 파일 실행 및 결과 가져오기
try:
env = os.environ.copy()
env['LC_ALL'] = 'en_US.UTF-8' # utf-8 환경 변수 설정
php_output = subprocess.check_output(['php', php_file_path, paymentType, orderId, paymentKey, amount], stderr=subprocess.STDOUT, universal_newlines=True, env=env,encoding='utf-8')
except subprocess.CalledProcessError as e:
php_output = f'Error executing PHP: {e.output}'
# PHP 결과를 HTML로 렌더링하여 출력
html_output = f'<pre>{php_output}</pre>'
return render_template_string(html_output)
혹시 플라스크쪽 코드도 알려주실 수 있을까요?
php 는 딱히 건든거 없고 플라스크로 이렇게 열고 있는데 자꾸만 오류가 나네요
@app.route('/success.php', methods=['GET'])
def display_php_file():
# GET 매개변수에서 필요한 값을 가져옵니다.
paymentType = request.args.get('paymentType')
orderId = request.args.get('orderId')
paymentKey = request.args.get('paymentKey')
amount = request.args.get('amount')
# PHP 파일 경로
php_file_path = 'templates/php/success.php'
# PHP 파일 실행 및 결과 가져오기
try:
env = os.environ.copy()
env['LC_ALL'] = 'en_US.UTF-8' # utf-8 환경 변수 설정
php_output = subprocess.check_output(['php', php_file_path, paymentType, orderId, paymentKey, amount], stderr=subprocess.STDOUT, universal_newlines=True, env=env,encoding='utf-8')
except subprocess.CalledProcessError as e:
php_output = f'Error executing PHP: {e.output}'
# PHP 결과를 HTML로 렌더링하여 출력
html_output = f'<pre>{php_output}</pre>'
return render_template_string(html_output)
혹시 플라스크쪽 코드도 알려주실 수 있을까요?

