ajax
<script type="text/javascript">
var zp_url = "http://hjzj/weldhome/index.php/img/index";
$.ajax({
url:zp_url,
type: 'post',
data:{
"content":'<?php echo $content;?>'
},
dataType:'json',
cache: false,
error: function(){
alert('出錯了!');
return false;
},
success:function(json){
var a = json.content;
$('.TEXT').html(a);
},
});
</script>
php
public function index(){
$content = $_POST['content'];
//$str = base64_encode($str);//編碼
$str = base64_decode($content);//解碼
$arr = array('content'=>$str);
echo json_encode($arr);
}