javascript - js代码怎么转php

查看:104
本文介绍了javascript - js代码怎么转php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

function get_hot_posts(day)
{
    $('#hot_question_list').html('<p style="padding: 15px 0" align="center"><img src="' + G_STATIC_URL + '/common/loading_b.gif" alt="" /></p>');
    
    $.get(G_BASE_URL + '/explore/ajax/ztlist/sort_type-hot__feature_id-' + FEATURE_ID + '__day-' + day + '__per_page-5', function (response)
    {
        if ($.trim(response) != '')
        {
            $('#hot_question_list').html(response);
        }
        else
        {
            $('#hot_question_list').html('<p style="padding: 15px 0" align="center">' + _t('没有内容') + '</p>');
        }
    });
}

$(document).ready(function () {
    $('#feature_dynamic a').click(function ()
    {
        if ($(this).attr('href') == '#unresponsive')
        {
            AWS.load_list_view(G_BASE_URL + '/explore/ajax/ztlist/sort_type-unresponsive__per_page-10__feature_id-' + FEATURE_ID, $('#bp_all_more'), $('#c_all_list'), 1);
        }
        else
        {
            AWS.load_list_view(G_BASE_URL + '/explore/ajax/ztlist/sort_type-new__feature_id-' + FEATURE_ID, $('#bp_all_more'), $('#c_all_list'), 1);
        }
    });

    $('#hot_question_control li.active a').click();
    $('#feature_dynamic li.active a').click();
    
    $.get(G_BASE_URL + '/topic/ajax/question_list/type-best__feature_id-' + FEATURE_ID, function (result) {
        if ($.trim(result) != '')
        {
            $('#c_best_list').html(result);
        }
    });

    AWS.Init.init_comment_box('.aw-add-comment');
});

怎么把这个转成php

解决方案

这代码本身是js的代码,你如果想在php中使用就直接用<scription>包起来就可用了。
如果你是指ajax请求的地址内容的话,那这个就是业务逻辑处理了。

这篇关于javascript - js代码怎么转php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆