Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在我的 rails 应用程序中获取浏览器 GPS 坐标(在带有 GPS 的移动设备上),并在创建新记录时保存它们。有可能吗?怎么做?
谢谢
您可以使用 html5 地理定位,看看这个例子http://html5demos.com/geo。
或者你可以获取请求ip,并通过一些服务进行地理定位,但是这种方法不是很准确。
看看这个名为geocoder http://www.rubygeocoder.com/的伟大宝石
geocoder
我有一个简单的 CakePHP 应用程序,在我的视图中,我为每个视图动态设置标题:
<? $this->viewVars['title_for_layout'] = 'Wicked Awesome Title' ?>
但是在我的一台机器上,代码没有运行,而是输出到浏览器窗口,就好像它不是被识别的 PHP 代码一样。