例如,来自C#的PHP代码

时间:2017-01-18 06:24:17

标签: c# php

我有以下PHP和PHP代码。我不知道如何转换它,因为我不熟悉PHP。

我迷失了,似乎不确定这里到底发生了什么。这只是我必须使用的PHP代码的一部分&转换为c#for asp.net

Any help in this regard is apprecaited

if ($this->can_init()) {
    $preload='<iframe style="width:1px;height:1px;visibility:hidden;display:none;" src="https://secure.telrcdn.com/preload.html"></iframe>';
    $this->enabled          = $this->get_config_option('enabled');
    $this->title            = $this->get_config_option('title');
    $this->description      = $this->get_config_option('description').$preload;
    $this->store_id         = $this->get_config_option('store_id');
    $this->store_secret     = $this->get_config_option('store_secret');
    $this->testmode         = $this->get_config_option('testmode');
    $this->debug            = $this->get_config_option('debug');
    $this->order_status     = $this->get_config_option('order_status');
    $this->cart_desc        = $this->get_config_option('cart_desc');
    $this->form_submission_method   = true;
    $this->api_endpoint = 'https://secure.telr.com/gateway/order.json';
    // Actions
    add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options'));
    add_action( 'woocommerce_thankyou', array($this, 'update_order_status'));
} else {
    $this->enabled = false;
}

页面的完整代码在这里https://jsfiddle.net/7m4wdfLt/

1 个答案:

答案 0 :(得分:1)

我试图将上述代码重写为ASP C#。 这相当于你的PHP。

<%
Dim gv_this, gv_preload

If gv_this->can_init() then
gv_preload = "<iframe style=""width:1px;height:1px;visibility:hidden;display:none;"" src=""https://secure.telrcdn.com/preload.html""></iframe>'
$this->enabled           = $this->get_config_option('enabled')
$this->title             = $this->get_config_option('title')
$this->description       = $this->get_config_option("description').gv_preload
gv_this->store_id          = gv_this->get_config_option('store_id')
gv_this->store_secret      = gv_this->get_config_option("store_secret')
$this->testmode          = $this->get_config_option('testmode')
$this->debug             = $this->get_config_option('debug')
$this->order_status      = $this->get_config_option("order_status')
gv_this->cart_desc         = gv_this->get_config_option('cart_desc')
gv_this->form_submission_method    = true
gv_this->api_endpoint  = "https://secure.telr.com/gateway/order.json"
' Actions
add_action('woocommerce_update_options_payment_gateways_'.gv_this->id, array(gv_this, 'process_admin_options'));
 add_action('woocommerce_thankyou',Array ( gv_this, "update_order_status" )
;Else
gv_this->enabled  = false
End If

%>

希望这会对你有所帮助。