【问题标题】:How do we take user inputs in Jdoodle Api?我们如何在 Jdoodle Api 中获取用户输入?
【发布时间】:2020-11-05 22:27:26
【问题描述】:

我想在 JDoodle Api 中接受用户输入

我正在使用下面的数据

 $postData = array(
            "script" => $code,
            "language" => $language,
            "versionIndex" => "2",
            "clientId" => "ed3d8b92ac70bc1c3ad2382d334afc1d",
            "clientSecret" => $hiddenKey
        );

我正在创建以下上下文请求

 $context = stream_context_create(array(
            'http' => array(
                'method' => 'POST',
                'header' =>  "Content-Type: application/json\r\n",
                'content' => json_encode($postData)
            )
        ));

如何在 JDoodle Api 中为以下代码获取用户输入?

import java.util.Scanner;

public class MainClass {
    public static void main(String[] Args) {
        System.out.println("Enter x = ");
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        System.out.println("X = "+x);
    }
}

【问题讨论】:

    标签: api input user-input jdoodle


    【解决方案1】:

    还有一个名为 stdin 的字段。你可以把它当做。

    $postData = array(
                "script" => $code,
                "language" => $language,
                "versionIndex" => "2",
                "clientId" => "ed3d8b92ac70bc1c3ad2382d334afc1d",
                "clientSecret" => $hiddenKey,
                "stdin" => "YOUR_INPUT"
            );
    

    【讨论】:

      猜你喜欢
      • 2019-11-23
      • 2021-10-12
      • 2021-10-08
      • 1970-01-01
      • 2010-11-10
      • 2011-07-14
      • 1970-01-01
      相关资源
      最近更新 更多