Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在restler中使用camel大小写作为函数名_Php_Restler - Fatal编程技术网

Php 在restler中使用camel大小写作为函数名

Php 在restler中使用camel大小写作为函数名,php,restler,Php,Restler,只要名称现在是大小写混合的,它就可以工作。 应该是这样吗?有没有办法使用骆驼套 谢谢 为了重新审视这一点,我一直在玩弄代码,我也得到了类似的行为。我的方法的以下命名约定导致404错误: mysite.com/myclass/testMethod mysite.com/myclass/TestMethod 以下工作如预期所示 mysite.com/myclass/testmethod mysite.com/myclass/test\u方法 有什么办法(我错过了或其他)让骆驼案起作用吗 更新:方法名

只要名称现在是大小写混合的,它就可以工作。 应该是这样吗?有没有办法使用骆驼套


谢谢

为了重新审视这一点,我一直在玩弄代码,我也得到了类似的行为。我的方法的以下命名约定导致404错误:

mysite.com/myclass/testMethod
mysite.com/myclass/TestMethod

以下工作如预期所示

mysite.com/myclass/testmethod
mysite.com/myclass/test\u方法

有什么办法(我错过了或其他)让骆驼案起作用吗


更新:方法名称似乎没有引起错误,例如,我可以将其命名为testMethod,但仍然用小写形式调用。

更新@richard_askew的答案,他是对的

当我们在Restler版本2.1.5或更低版本中使用自动路由时,类名、方法名和参数名必须全部小写

我们刚刚发布了Restler 2.1.6版,它改变了这种行为:)


现在,在url中指定的类名、方法名和参数名在任何情况下(上限、下限或混合)都将与正确的方法匹配

有趣的是,在我看来没有什么问题。我也想看看这个问题的答案。我们能看看你在哪里调用这个函数吗?可能是您试图用小写形式调用该函数。
This is the web service file _ws.php
<?php
/*
 Title: Hello World Example.
 Tagline: Let's say hello!.
 Description: Basic hello world example to get started with Restler 2.0.
 Example 1: GET say/hello returns "Hello world!".
 Example 2: GET say/hello/restler2.0 returns "Hello Restler2.0!".
 Example 3: GET say/hello?to=R.Arul%20Kumaran returns "Hello R.Arul Kumaran!".
 */
require_once '../restler/restler.php';
require_once 'news_class.php';
$r = new Restler();
$r->addAPIClass('news');
$r->handle();
<?php
class news {
    function hello($to='world') {
        return "Hello $to!";
    }

    function listnews($page=0){
        $result = "";

        $xml_doc = new DOMDocument;
        $xml_doc->load('news.xml');

        $xsl_doc = new DOMDocument;
        $xsl_doc->load('news_list.xsl');

        $xsl_proc = new XSLTProcessor();
        $xsl_proc->importStyleSheet($xsl_doc);
        $xsl_proc->setParameter('', 'page', $page);
        $result = $xsl_proc->transformToXml($xml_doc);

        return $result;
    }


} // news -
{
  "error": {
    "code": 404,
    "message": "Not Found"
  }
}