php - 我如何发送交易报价

标签 php api codeigniter steam steam-web-api

实际上,我正在开发 Steam 交易报价功能,但遇到了问题。我已经下载了 Steam 类库并在 Codeigniter 中实现了它。我正在按照 https://github.com/halipso/php-steam-tradeoffers#setupsessionid-cookies 中的设置指南进行操作这个。其实我不知道session id和cookie:

$steam->setup('sessionID', 'cookies');

sessionIDcookies 是什么?

我已经阅读了它,但没有得到任何解决方案。我如何在我的代码中获取和实现它?

最佳答案

好吧,如果这是在 Laravel 上,您可以发送 _token,它们将其称为 csrf_field


在 CI 中你可以这样做。 (csrf 生成唯一 session ID)

路径 - application/config/config.php

$config['csrf_protection'] = TRUE;

在登录表单中,你可以添加这个或者在页面初始化中你可以添加这个

$csrf = array(
        'name' => $this->security->get_csrf_token_name(),
        'hash' => $this->security->get_csrf_hash()
);

<input type="hidden" name="<?=$csrf['name'];?>" value="<?=$csrf['hash'];?>" />

所以在保存的时候你可以把这个添加到 session 中。顺便说一句,这个 token 也可以用于 cookie。

阅读此 Cross-site request forgery (CSRF)

Tokens may be either regenerated on every submission (default) or kept the same throughout the life of the CSRF cookie. The default regeneration of tokens provides stricter security, but may result in usability concerns as other tokens become invalid (back/forward navigation, multiple tabs/windows, asynchronous actions, etc). You may alter this behavior by editing the following config parameter

Source Codeigniter documentation


如果它不在登录页面中,则

最好选择这个false,(因为这个 token 可能会在每次提交时重新生成(默认))

$config['csrf_regenerate'] = FALSE;

关于php - 我如何发送交易报价,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47196583/

相关文章:

php - php中的post方法

php - 当右表中的记录不可用时,Laravel 左连接返回空结果

rest - Go REST Api 中的角色和权限

ios - 错误代码 : Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set."

mysql - 创建一个触发器,用于将客户端 ip 地址放入 MySQL 的列中

javascript - 如何提交一个值并在下一页中选择该选项?

javascript - 将ajax请求中的javascript变量设置到mysql数据库

java - Twitter4J - 在不登录的情况下查看个人资料详细信息

codeigniter - 更改下载文件名 codeigniter

php - Codeigniter View 函数更改为 $template