小编Ste*_*aya的帖子

如何在Laravel 4中使用RESTful实现指向控制器的命名路由?

我在http://codebright.daylerees.com/上关注Laravel 4教程.

在codebright.daylerees.com/controllers中,您可以看到RESTful Controllers教程

我到达了高级路由教程codebright.daylerees.com/advanced-routing.

有一个示例代码可以使用Route :: get和命名路由.然后我尝试使用Route :: controller来创建具有命名路由的RESTful URI.然后,我尝试将此代码编写为routes.php:

Route::controller('my/very/long/article/route2', array(
'as'=>'article2',
'uses'=>'Blog\Controller\Article'
));
Run Code Online (Sandbox Code Playgroud)

这是我的controller/Article.php代码:

<?php
namespace Blog\Controller;
use View;
use BaseController;

class Article extends BaseController
{
    public function getCreate()
    {
       return View::make('create');
    }
    public function postCreate()
    {

    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试访问我的/ very/long/article/route2/create时,它显示错误

ErrorException
Array to string conversion
…\vendor\laravel\framework\src\Illuminate\Routing\Controllers\Inspector.php
Run Code Online (Sandbox Code Playgroud)

知道如何使用RESTful实现到控制器的命名路由吗?

php rest laravel laravel-4

6
推荐指数
2
解决办法
2860
查看次数

PHP mail()函数返回true但没有消息

这是我的问题,

我有一个简单的PHP脚本,可以通过水银邮件服务器向localhost发送电子邮件,并使用Mozilla Thunderbird进行阅读.这是工作.

然后,我将XAMPP版本升级到1.8.1并且我的函数返回true但没有发送电子邮件.

<?php
$to = "root@localhost.com";
$subject = "Hi!";
$body="test";

$headers = "From: root@localhost.com"; 

if (mail($to, $subject, $body, $headers)) {
    echo "Message successfully sent!";
} else {
    echo "Message delivery failed...";
}
?>
Run Code Online (Sandbox Code Playgroud)

我尝试使用Thunderbird发送电子邮件到root@localhost.com并且它可以工作.

所以我尝试将php.ini中的邮件功能更改为此但不起作用

    [mail function]
    ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
     SMTP = localhost
     smtp_port = 25

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = root@localhost.com

    ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in …
Run Code Online (Sandbox Code Playgroud)

php email xampp

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

标签 统计

php ×2

email ×1

laravel ×1

laravel-4 ×1

rest ×1

xampp ×1