我正在使用表单从用户提取iframe代码并将其插入另一个页面。但是,当代码被插入时,它会在混合中插入一个“\”。PHP表单插入代码
这里是原代码:
<iframe src='http://listings.realbird.com/home-search-o/?rb_id=N7T5O2I2&bq=[item type:housing][location:@%22Reno, Nv%22][listing type:housing/sale][property type:/foreclosure]&orderby=price' frameborder='0' width='100%' height='2700' style='width:100%; height:2700px;'></iframe>
这里是代码的PHP文件处理后:
<iframe src=\'http://listings.realbird.com/home-search-o/?rb_id=N7T5O2I2&bq=[item type:housing][location:@%22Reno, Nv%22][listing type:housing/sale][property type:/foreclosure]&orderby=price\' frameborder=\'0\' width=\'100%\' height=\'2700\' style=\'width:100%; height:2700px;\'></iframe>
任何办法来防止这种情况发生?
使用双引号!它不喜欢那些单曲,所以它逃避了他们......也就是说,如果你有控制权。 –