小编jus*_*eak的帖子

得到GET"?" laravel变量

你好我使用REST API创建并按照Laravel 文章.

一切都按预期运作良好.

现在,我想使用"?"映射GET请求以识别变量.

例如: domain/api/v1/todos?start=1&limit=2

以下是我的routes.php的内容:

Route::any('api/v1/todos/(:num?)', array(
    'as'   => 'api.todos',
    'uses' => 'api.todos@index'
));
Run Code Online (Sandbox Code Playgroud)

我的控制器/ api/todos.php:

class Api_Todos_Controller extends Base_Controller {

    public $restful = true;

    public function get_index($id = null) {
        if(is_null($id)) {
            return Response::eloquent(Todo::all(1));

        } else {
            $todo = Todo::find($id);
            if (is_null($todo)) {
                return Response::json('Todo not found', 404);
            } else {
                return Response::eloquent($todo);   
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如何使用"?"识别get参数 ?

php api rest laravel

43
推荐指数
5
解决办法
10万
查看次数

在Phonegap android上可拖动的jQuery

我在Android上实现jQuery Draggable http://jqueryui.com/demos/draggable/时遇到了一些问题.我已经创建了html代码并使用我的浏览器对其进行了测试.然后我在build.phonegap.com上编译它.获得.apk后,我将它安装在使用Android 2.2 Froyo的xp​​eria x8上.应用程序运行良好,但是当我拖动对象时它不会移动..我的方法有问题吗?谢谢

jquery android cordova

5
推荐指数
1
解决办法
1万
查看次数

计算图像算法的对象

我又上学了.这一次,我的老师给了我创建算法的任务来计算图片上有多少只鸭子.

图片与此类似:

我想我应该使用模式识别来搜索它上面有多少只鸭子.但我不知道每只鸭子的模式匹配.

algorithm image-processing pattern-matching

5
推荐指数
2
解决办法
3208
查看次数

在 Codeigniter 上删除 index.php 的问题没有加载我的 css 和 js

目前我试图删除 codeigniter url 上的 index.php。我在 localhost/jqm/withci 上安装了我的 codeigniter。然后我编写 .htaccess 来删除 index.php 并且它运行良好。.htaccess 文件:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /jqm/withci/index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

但我没有m having some problem, my css file and js won加载..我的控制器是

class Home extends CI_Controller {
    function __construct() {
        parent::__construct();
        $this->load->helpers('url');
    }

    function index() {
        $this->load->view('head_view');
        $this->load->view('main_view');
        $this->load->view('foot_view');
    }
}
Run Code Online (Sandbox Code Playgroud)

我对 head_view 的看法是:

<!DOCTYPE HTML>
<html>
  <head>
    <meta name="viewport" content="width=320; user-scalable=no" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title>jQuery Mobile with Codeigniter</title>
      <link rel="stylesheet" href="<?php echo base_url();?>jquery.mobile/jquery.mobile-1.0a4.1.css" type="text/css" charset="utf-8" …
Run Code Online (Sandbox Code Playgroud)

php mod-rewrite codeigniter

2
推荐指数
1
解决办法
2720
查看次数

使用Codeginiter在jQuery Mobile上进行Ajax请求

目前我正在尝试使用jQuery Mobile执行ajax请求.我试图在http://www.giantflyingsaucer.com/blog/?p=2574上使用示例.是的,它完美无缺.但是当我试图在codeigniter中使用代码时,问题就出现了.

这是我的控制器:

<?php
class Ajax extends CI_Controller {
    function __construct() {

    }

    function index() {
        ?>
        <!DOCTYPE html>
        <html>
            <head>
            <title>Submit a form via AJAX</title>
              <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />
              <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
              <script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>
        </head>
        <body>
            <script>
                function onSuccess(data, status)
                {
                    data = $.trim(data);
                    $("#notification").text(data);
                }

                function onError(data, status)
                {
                    // handle an error
                }        

                $(document).ready(function() {
                    $("#submit").click(function(){

                        var formData = $("#callAjaxForm").serialize();

                        $.ajax({
                            type: "POST",
                            url: "callajax",
                            cache: false,
                            data: formData,
                            success: onSuccess,
                            error: onError
                        });

                        return false; …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery codeigniter jquery-mobile

1
推荐指数
1
解决办法
2178
查看次数