如何删除json_encode数组的双引号

时间:2018-10-07 23:39:52

标签: php json

我希望能够删除我的json_encode中的双引号:

class App extends Component {
  constructor(){
    super();
        this.state={
           // stock: '',
        //  shares: '',
        //  items: []
        input: "",
        ticker_symbol: '',
        share_count: '',
        stocks: []
    }
  }

 onInputChange = (event) => {
   this.setState({input: event.target.value});
  }

  onInputChange2 = (event) =>{
    this.setState({input2:event.target.value});
  }

  onButtonSubmit = () =>{
    this.setState({ticker_symbol: this.state.input})
    this.setState({share_count: this.state.input2});
    console.log(this.ticker_symbol);
  }

  render() {

    return (
        <StockInputForm 
          onInputChange={this.onInputChange} 
          onInputChange2={this.onInputChange2}
          onButtonSubmit={this.onButtonSubmit} 
        />

我的结果是:

 $response = array(
        "response" => true,
        "ack_move" => array(
            "slot" => $move,
            "isWin" => false,
            "isDraw" => false,
            "row" => array()
        );
echo json_encode($response);

我要删除整数“ 3”的双引号

我该怎么做呢?

{"response":true,"ack_move":{"slot":"3","isWin":false,"isDraw":false,"row":[]}

1 个答案:

答案 0 :(得分:2)

您可以尝试使用函数intval($ move)获取整数值,然后分配该值。

http://php.net/manual/en/function.intval.php