小编Jef*_*Yan的帖子

无法在“ file_get_contents()”中加载cafile流?

我正在尝试从Google地理编码API获取JSON数据。但是,PHP警告显示有关“无法加载cafile流”的一些错误

这是我的代码:

$apiKey  = 'apikey';
$address = urlencode( '1600 Amphitheatre Pkwy, Mountain View, CA 94043' 
);
$url     = "https://maps.googleapis.com/maps/api/geocode/json?address= 
    {$address}key={apiKey}";
$resp    = json_decode( file_get_contents( $url ), true );
echo $url;

$lat    = $resp['results'][0]['geometry']['location']['lat'] ?? '';
$long   = $resp['results'][0]['geometry']['location']['lng'] ?? '';
Run Code Online (Sandbox Code Playgroud)

这是错误:

PHP Warning:  failed loading cafile stream: `C:\xampp\apache\bin\curl-ca- 
bundle.crt' in C:\Users\1\Desktop\test.php on line 7

Warning: failed loading cafile stream: `C:\xampp\apache\bin\curl-ca- 
bundle.crt' in C:\Users\1\Desktop\test.php on line 7
PHP Warning:  file_get_contents(): Failed to enable crypto in 
C:\Users\1\Desktop\test.php on line 7

Warning: file_get_contents(): …
Run Code Online (Sandbox Code Playgroud)

php google-geocoding-api

2
推荐指数
1
解决办法
3337
查看次数

如何定义函数的类型签名?

doWithFunctionArg :: ? -> Int -> Int -> Int 
doWithFunctionArg f a b = f a b

multiply :: Int -> Int -> Int
multiply a b = a * b

main = do
    print $ doWithFunctionArg mutiple 7 8
Run Code Online (Sandbox Code Playgroud)

我不确定函数的类型签名是什么.multiply :: Int -> Int -> Int乘法函数的函数类型签名是什么?如果是,我该如何为函数编写类型签名doWithFunctionArgdoWithFunctionArg函数有三个参数,"f"是函数类型,"a"和"b"是Int,结果应该是Int.如果我是对的,我该怎么写"?"

haskell type-signature

1
推荐指数
1
解决办法
63
查看次数

声明一个没有返回值的函数?

我们可以在函数式语言中创建一个带void(即没有返回值)的函数吗?像Haskell或Scheme

scheme haskell functional-programming

-1
推荐指数
2
解决办法
2520
查看次数