当我的表单帖子中有整数和浮点数并在我有梁文件的 ebin 文件中接收这些时,我遇到了问题。希望可以有人帮帮我。
npower.yaws
<erl>
kv(K,L) ->
{value, {K, V}} = lists:keysearch(K,1,L), V.
out(A) ->
L = yaws_api:parse_post(A),
N = kv("number", L),
npower62:math3(N).
</erl>
npower62.erl 编译成束文件
-module(npower62)。
-导出([math3/1])。
math3( [N] ) ->
Number = N,
Nsquare = Number * Number,
{html, io_lib:format("square of ~c = ~w", [N, Nsquare])}。
给我 3 = 2601
的平方而不是
3 = 9的平方
我尝试使用 Number = list_to_integer(atom_to_list(N)) (不起作用)
我尝试使用 Number = list_to_float(atom_to_list(N)) (不起作用)
我尝试使用 Number = list_to_integer(N) (不起作用)