$ npm install -g typings$ typings install dt~node dt~express --global --save$ npm install -g typings$ typings install dt~node dt~express --global --save| <?php | |
| // https://developer.mozilla.org/zh-TW/docs/HTTP/Access_control_CORS | |
| if (isset($_SERVER['HTTP_ORIGIN'])) { | |
| header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); | |
| header('Access-Control-Max-Age: 86400'); // day | |
| header('Access-Control-Allow-Credentials: true'); | |
| } | |
| if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { |
--
| // 清除空白、換行 | |
| public static string clear(string text) | |
| { | |
| var cls = new[] { "\r", "\n", " ", " " }; | |
| foreach (var cl in cls) | |
| { | |
| text = text.Replace(cl, string.Empty); | |
| } | |
| return text.Trim(); | |
| } |