将英镑£符号从数字后移到其前

时间:2019-02-15 17:32:23

标签: php

我的字符串如下:

<b>100£</b> was £160 

如您所见,100£是错误的,应该是£100

有人知道如何在PHP中将第一个£符号移动到第一个数字之前,而不触碰第二个(正确)吗?

非常感谢您

1 个答案:

答案 0 :(得分:1)

这应该有效:

@phones.route('/contact', methods=['GET', 'POST'])
def contact():
form = ContactForm()
email = form.email.data
if request.method == 'POST':
if form.validate() == False:
  flash('All fields are required.')
  return render_template('phones/contact.html', form=form)
else:
  msg = Message(form.subject.data, sender='sameemail@gmail.com', 
recipients='sameemail@gmail.com')
  msg.body = """
  From: %s %s


  %s
  """ % (form.name.data, form.email.data, form.message.data)
  mail.send(msg)
  flash(f'Your email has been sent', 'success')  
  return redirect(url_for('main.index'))

elif request.method == 'GET':
return render_template('phones/contact.html', form=form)