作者rlearner (rlearner)
看板PHP
標題[請益] js+rshiny之間用php連接
時間Wed Dec 14 11:42:58 2016
這個問題不知能不在該板題問@@
[環境架設/問題簡敘]
我在實體機上ubuntu上架設了shiny server
測試用的shiny範例程式所放路徑:
$cd /opt/shiny-server/samples/sample-apps
並放了幾個範例程式,如下
http://140.128.197.58:3838/sample-apps/
(問題所在!!!!)但在嘗試leaflet地圖套件時出錯:
http://140.128.197.58:3838/sample-apps/leaflet1/
不過leaflet應用在js上就可以了@_@
http://140.128.197.58:3838/sample-apps/html-samples/leaflet.html
這是用rshiny抓取伺服器上mysql的資料
http://140.128.197.58:3838/sample-apps/rmysql2/
[目的]
所以我想用js寫好的leaflet套件用php連接rshiny
或直接用php連sql也可
[程式碼]
以下是js呈現leaflet的code
http://140.128.197.58:3838/sample-apps/html-samples/leaflet.html
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet"
href="
http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="
http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
<body>
<div id="map"></div>
<script>
// initialize the map
var map = L.map('map').setView([24.179,120.601], 16);
// load a tile layer
L.tileLayer('
http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="
http://osm.org/copyright">OpenStreetMap</a>
contributors'
}).addTo(map);
L.marker([24.179,120.601]).addTo(map)
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
.openPopup();
</script>
</body>
</html>
[環境版本]
ubuntu 14.04.05
shiny-server 1.5.1
R 3.3.2
leaflet 1.0.1
請問可能行嗎??
php初學者讓如何入門??
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.128.101.143
※ 文章網址: https://webptt.com/m.aspx?n=bbs/PHP/M.1481686984.A.988.html
1F:→ gpmm: 不太懂你的用 php 連接 rshiny 是指? 12/14 13:50
2F:→ gpmm: 我翻了一下 shiny,應該直接就可以處理掉你要的部份 12/14 13:51
3F:→ gpmm: 而且看起來你也透過 shiny 接上 mysql 了,你的目的是什麼啊 12/14 13:51
4F:→ rlearner: 抱歉問太急我整理一下 12/14 16:24
5F:→ rlearner: 因為無法在shiny上執行leaflet(地圖套件) 12/14 16:26
6F:→ rlearner: 所以我想直接用php連mysql並用js讀取,這是一步@@ 12/14 16:27
7F:推 mikejaffson: 若是後者,那你必須先知道js該收到的是怎樣format的r 12/14 16:36
8F:→ mikejaffson: esponse。 12/14 16:36
9F:→ mikejaffson: 而php就依照規格去query result並print需要的respons 12/14 16:36
10F:→ mikejaffson: e 12/14 16:36
11F:→ rlearner: 好的 感謝 12/14 17:15
12F:→ gpmm: leaflet 我用過,他是純 js 的東西啊,不需要特殊規格的後端 12/14 22:09
13F:→ gpmm: 支援。你可以打開 console 確認一下有哪些 error 再來處理 12/14 22:10
14F:→ rlearner: 好的 12/15 20:51