dougong5285 2019-04-03 01:45
浏览 186

使用表单中的文本框设置值

I have seen this code from https://www.codexworld.com to Create a URL Shortener using PHP.

// Include database configuration file
require_once 'dbConfig.php';

// Include URL Shortener library file
require_once 'Shortener.class.php';

// Initialize Shortener class and pass PDO object
$shortener = new Shortener($db);

// Long URL
$longURL = 'https://www.codexworld.com/tutorials/php/';

// Prefix of the short URL 
$shortURL_Prefix = 'https://localhost/'; // with URL rewrite
$shortURL_Prefix = 'https://localhost/?c='; // without URL rewrite

try{
    // Get short code of the URL
    $shortCode = $shortener->urlToShortCode($longURL);

    // Create short URL
    $shortURL = $shortURL_Prefix.$shortCode;

    // Display short URL
    echo 'Short URL: '.$shortURL;
}catch(Exception $e){
    // Display error
    echo $e->getMessage();
}

I have understood how the system goes but dont know how can this line of code $longURL = 'https://www.codexworld.com/tutorials/php/'; will not be based on static value but will be dynamic by collecting the link where the user will type it using a textbox input in a form?

How can I do that? Thank you in advance!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料