小编sou*_*ner的帖子

Phalcon Micro应用程序无法使用查询字符串正确路由

我正在尝试使用Phalcon中Micro应用程序开发RESTful API .现在我正在使用面向PHP的Facebook SDK进行社交登录,但我发现当Facebook将我重定向到我的回调(显然内部查询字符串)时,路由器找不到任何处理程序方法.

GET: http://localhost:8000/api/v1/register/facebook/callback?code=...&state=...#_=_

Not-Found handler is not callable or is not defined
#0 /home/adrian/PhpstormProjects/myproject/index.php(39): Phalcon\Mvc\Micro->handle()
#1 {main}
Run Code Online (Sandbox Code Playgroud)

我所有的其他路由都正常工作,但这是我第一次面对查询字符串,所以我不知道我做错了什么.

我正在使用Micro Collections进行路由和PHP 内置服务器.

这是我的.htrouter.php.当我抑制从查询字符串$_SERVER['REQUEST_URI']路径工作正常,但因为它期待参数Facebook的SDK失败.我试图找出Phalcon是否将URL和查询字符串保存在不同的$_GET变量中,但我认为情况并非如此.

<?php
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
    $_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;
Run Code Online (Sandbox Code Playgroud)

我的 micro-collection.php

<?php

use \Phalcon\Mvc\Micro\Collection as MicroCollection;

$register = new MicroCollection();
$register->setHandler('App\Controllers\V1\RegisterController', true);
$register->setPrefix('/api/v1/register');
$register->get('/facebook', 'getAuthFacebook');
$register->get('/facebook/callback', 'facebookCallback');

return $register; …
Run Code Online (Sandbox Code Playgroud)

routing query-string phalcon php-builtin-server

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

无法使用Code :: Blocks在linux中编译C++

#include <iostream>

using namespace std;

int main(){
    int intake;

    cout<<"Enter the maximum number of intake in this session of 2015, September: ";
    cin>>intake;

    for(int i=20150900; i<intake+20150900; i++){
        cout<<"Enter the total percentage of Student ID numbered #"<<i<<": ";
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我的代码,当我在code :: blocks上编译它时会出现以下错误.我是linux OS的新手,所以我不太了解它是如何工作的.谢谢你的帮助!:) 错误信息:

g ++ -c /home/subbs/Desktop/entrance_exam/main.cpp -o /home/subbs/Desktop/entrance_exam/main.o/bin/sh:1:g ++:not found

c++ linux codeblocks linux-mint

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