作者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/cn.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