결제기능 제작중인데 자꾸 막히네요;;

와 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)

?
image.png
Was this page helpful?