小编Gan*_*nly的帖子

Wordpress Woocommerce从定制运输领域(AJAX)获得价值

所以我有一个使用woocommerce的电子商务,我使用自定义运费来跟踪运费.我已经添加了新的输入数据(选择).就像你在下面的图片中看到的那样: 在此输入图像描述

// Hook in
add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields($fields) {

    $fields['billing']['billing_city'] = array(
        'type' => 'select',
        'label' => __('Kota / Kabupaten', 'woocommerce'),
        'required' => true,
        'class' => array('form-row-wide', 'address-field'),
        'clear' => true,
        'options' => array(
            '' => 'Pilih Kota / Kabupaten'
        )
    );
    $fields['shipping']['shipping_city'] = array(
        'type' => 'select',
        'label' => __('Kota / Kabupaten', 'woocommerce'),
        'required' => true,
        'class' => array('form-row-wide', 'address-field'),
        'clear' => true,
        'options' => array(
            '' …
Run Code Online (Sandbox Code Playgroud)

php wordpress woocommerce

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

未找到Laravel 5路由对象

我uuualy使用Laravel 4,现在我想学习Laravel 5

命名控制器路由有问题:

我有这样的路线:

Route::get('/', [
    'uses' => 'HomeController@viewHome', 
    'as' => 'home'
]);

Route::get('/events', [
        'uses' => 'EventController@viewEvent', 
        'as' => 'event'
    ]);
Run Code Online (Sandbox Code Playgroud)

当我作为'home'(localhost/laravel /)运行路线时,它的工作非常完美

但是当我将路线作为'event'(localhost/laravel/events)运行时:找不到对象! 在此输入图像描述

我已经确保通过交换它运行的viewEvent方法如下:

Route::get('/', [
    'uses' => 'EventController@viewEvent', 
    'as' => 'home'
]);

Route::get('/events', [
        'uses' => 'HomeController@viewHome', 
        'as' => 'event'
    ]);
Run Code Online (Sandbox Code Playgroud)

我可以运行viewEvent,但我无法运行viewHome

我的代码有什么问题吗?

========================已解决========================= ====

帮助@DamienPirzy并且我意识到当我禁用/ public /文件夹时我想我必须将.htaccess输出到主文件夹:)

谢谢所有快速响应:)问题解决了

php laravel laravel-routing laravel-5

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

Laravel URL Route获取2参数

我需要删除相册中的照片,所以我认为我需要2个参数路由但我收到一些错误请给我解决方案或其他方式从相册中删除照片

这是我的Routes.php:

Route::get('/admin/album/{albumid}/{id}/delete-photo', array(
    'as' => 'admin-photo-delete',
    'uses' => 'GalleryController@deletePhoto'
));
Run Code Online (Sandbox Code Playgroud)

并在GalleryController上调用函数deletePhoto,这是GalleryController:

public function deletePhoto($albumID,$photoID){
$photo = Album::find($albumID)->photo()->where('id','=',$photoID)->get();
if($photo){
    File::delete(public_path().'/assets/images/gallery/'.$photo->images);
    $photo->delete();
    return Redirect::route('admin-gallery')->with('message','Photo was deleted successfully');
}
return Redirect::route('admin-gallery')->with('message','Photo delete failed');}
Run Code Online (Sandbox Code Playgroud)

在这里我如何称呼路线:

 <a href="{{URL::route('admin-photo-delete',$id,$photo->id)}}">Delete Photo</a>
Run Code Online (Sandbox Code Playgroud)

我已经确定$ id和$ photo-> id不是null但是看看哪个url显示没有第二个参数值所以我得到一些错误: 在此输入图像描述

laravel laravel-4 laravel-routing

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