提交表单时,我正在使用 javascript 的encodeURIComponent()函数对 URL 进行编码:
  <form name="form" action="actions.php" method="post">
      <input type="text" name="url" id="url" value="http://">
      <script type="text/javascript">
        function encodeLinks(){
            var e = document.getElementById('url')
            e.value = encodeURIComponent(e.value);        
        }  
      </script>
        <button type="submit" class="btn btn-primary" onclick="encodeLinks()">Submit</button>
    </form>
将数据返回到操作页面上的 javascript 以便对其进行解码然后在 mysql 查询中使用它的最有效方法是什么?