我在URL中传递了一些参数,如下所示:
const Web3 = require('web3');
const Tx = require('ethereumjs-tx');
const provider = new Web3.providers.HttpProvider("http://146.185.128.50:8541");
const web3 = new Web3(provider);
console.log("Parity server", web3.version.api);
const pkey = 'privatekey';
const account = web3.eth.accounts.privateKeyToAccount('0x' + pkey);
console.log("Account:", account.address);
web3.eth.getBalance(account.address).
then(r => console.log("Balance:", web3.utils.fromWei(r), "ETH"));
console.log("Set account as default:", account.address);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;
var abi = [{ABI contract...}];
var myContract = new web3.eth.Contract(abi, 'Contract address...');
myContract
.methods
.submitTransaction("Contract address...", 2, '0x7065cb480000000000000000000000000053583ecb7fceba61be60629c4b7c2490748d65')
.send({from : account.address,
gas: 800000,
gasPrice: '0x09184e72a000'
})
我接受此URL的路由器代码为:
sample/team/highestScore/1
但是在控制器中,我得到的参数' tab '的值为最高分,表示为小写。我需要param值为 highestScore 。没有大小写转换时如何获得该值。
请告知。预先感谢。
答案 0 :(得分:0)
function teamAction($tab = null, $matchType = null)
{
exit(var_dump([
$tab,
$matchType
]));
}
$router = $di->getRouter();
$router->add(
'/sample/team/{tab:[a-zA-Z0-9-_]+}/{matchType:[0-9]+}',
[
'controller' => 'some',
'action' => 'team'
]
);
$router->handle();
测试网址phalcon_path/sample/team/highestScore/1
array (size=2)
0 => string 'highestScore' (length=12)
1 => string '1' (length=1)