国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

web-msg-sender一直提示已攔截跨源請(qǐng)求:同源策略禁止讀取位于...的遠(yuǎn)程資源,請(qǐng)問大神該如何解決?

何雨

按照github上提示做的,網(wǎng)址:https://github.com/walkor/phpsocket.io/tree/master/docs/zh
截圖如下

圖片

但是打開火狐一直提示“已攔截跨源請(qǐng)求:同源策略禁止讀取位于 http://39.106.121.125:3120/socket.io/?EIO=3&transport=polling&t=MUbA4T7 的遠(yuǎn)程資源”
截圖如下

圖片
?
?
客戶端訪問鏈接是:http://39.106.121.125/PHPCode/tools/web_socket/index.html
這個(gè)鏈接的源碼是

<html>
<head>
<script src='https://cdn.bootcss.com/socket.io/2.0.3/socket.io.js'></script>
<script>
// 如果服務(wù)端不在本機(jī),請(qǐng)把127.0.0.1改成服務(wù)端ip
console.log('成立');
var socket = io('http://39.106.121.125:3120');
// 當(dāng)連接服務(wù)端成功時(shí)觸發(fā)connect默認(rèn)事件
socket.on('connect', function(){
    console.log('connect success');
});
</script>

</head>
<body>

</body>
</html>

服務(wù)端php源碼

<?php
require_once '../web-msg-sender/vendor/autoload.php';
use Workerman\Worker;
use PHPSocketIO\SocketIO;

$io = new SocketIO(3120);
// 當(dāng)有客戶端連接時(shí)
$io->on('connection', function($socket)use($io){
  // 定義chat message事件回調(diào)函數(shù)
  $socket->on('chat message', function($msg)use($io){
    // 觸發(fā)所有客戶端定義的chat message from server事件
    $io->emit('chat message from server', $msg);
  });
});
Worker::runAll();

服務(wù)器啟動(dòng)該php程序提示如下
圖片
?
請(qǐng)問大神該如何解決這個(gè)跨域問題?

7839 1 0
1個(gè)回答

何雨

額,好吧,我忘記開放3120端口了,

  • 暫無評(píng)論
年代過于久遠(yuǎn),無法發(fā)表回答
??