php 处理shell_exec执行cmd命令行 10C

请问下,我想执行shell_exec(cmd: "java -jar"." ".$config." ".$file1);
错误提示:Parse error: syntax error, unexpected ':' in D:\phpStudy\PHPTutorial...


我想执行shell_exec(cmd: "java -jar"." ".$config." ".$file1);

如:$output = shell_exec('ls -lart');


橙虚缘 回复caozhy: 什么叫胡乱灌水,他语法都是错的
2 年多之前 回复
贵阳老马马善福专业维修游泳池堵漏防水工程 请管理员注意封杀这个胡乱灌水的垃圾用户。
2 年多之前 回复

打开php.ini,关掉安全模式safe_mode = off


cmd: 这么明显的错误没有人看到吗?“cmd: ”应该去掉,或者:号换成.号

exec($command, $retval, $status); $command就是命令语句

shell_exec(cmd: "java -jar"." ".$config." ".$file1);里边的参数有问题,不是一个字符串,cmd:,手册中是这样规定的,
string shell_exec ( string $cmd )

Csdn user default icon

<div class="post-text" itemprop="text"> <p>Is there any reason why I can not complied files in PHP's shell_exec/exec/system function?</p> <p>Example of something that does work in command line and PHP's shell_exec function:</p> <pre><code>&lt;?php $data = shell_exec("ls"); echo $data; ?&gt; </code></pre> <p>Example of something that does not work in PHP's shell_exec function but will work in command line (I can confirm that):</p> <pre><code>&lt;?php $data = shell_exec("./c-compiled-file argv1 argv2 argv3"); echo $data; ?&gt; </code></pre> <p>Is there anything I can do on my server so this will work? I've looked everywhere and no solutions I found fixed the problem. The compiled file is in the same directory as the PHP script as well, it just won't execute it. Also if you're asking, yes I have tried this with SSH2 and it still will not execute.</p> <p>Also PHP is not in safe mode and NO functions are disabled.</p> </div>

通过PHP执行cURL shell_exec()通过命令行返回与执行cURL不同的响应

<div class="post-text" itemprop="text"> <h1>I ran</h1> <p>a cURL on my Terminal </p> <p><strong>Note</strong> : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7</p> <pre><code>curl -c session_cookies.txt ";state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7&amp;nonce5ba13e5f-256d-425d-808b-1e05d2aa3d72&amp;response_type=code&amp;" 2&gt;/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d ';j_password=site1' "" 2&gt;&amp;1 &gt;/dev/null | grep Location | grep code= </code></pre> <hr> <p>I got this reponse back </p> <pre><code>&lt; Location:;state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7 </code></pre> <p><strong>Note</strong> : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7</p> <hr> <h1>PHP</h1> <p><strong>Note</strong> : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7</p> <pre><code>$cmd = 'curl -c session_cookies.txt ";state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7&amp;nonce5ba13e5f-256d-425d-808b-1e05d2aa3d72&amp;response_type=code&amp;" 2&gt;/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d ';j_password=site1' "" 2&gt;&amp;1 &gt;/dev/null | grep Location | grep code='; $result = shell_exec($cmd); dd($result); </code></pre> <hr> <blockquote> <p><strong>Note</strong> : state != b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7</p> <p><strong>Note</strong> : state = 12345678-256d-425d-808b-1e05d2aa3d72</p> </blockquote> <pre><code>&lt; Location:;state=12345678-256d-425d-808b-1e05d2aa3d72 </code></pre> <p>When I run shell_exec($cmd), my state always come back different the one that I submitted. How is this possible ? </p> <p>Is it caching somewhere on my local machine ? Should I clear something ?</p> <p>Why <code>shell_exec()</code> return slightly different result than if I would have do it directly on Terminal ? </p> <p>I even tried using <code>exec()</code>, same result. </p> <p><strong>How would one go about and debug this further ?</strong></p> <p>What elses should I look into ? </p> <hr> <p>I'm opening to any suggestions at this moment.</p> <p>Any hints / suggestions / helps on this be will be much appreciated !</p> </div>


<div class="post-text" itemprop="text"> <p>I'm actually working in a small project for myself, is a Web Application that creates Certificate Signing Request also the certificate <code>.pem/.crt</code> and its <code>.key</code>.</p> <p>The actual problem is that I'm trying to run:</p> <pre><code>shell_exec(openssl ca -config ../openssl.cnf -in $CSR_FILE -out $CRT_FILE) </code></pre> <p>And I find the problem that after running this command is asking for my CA passphrase, and later on answering Yes twice to accept the creation of the certificate. I can't figure it out how to make it work. I've been stuck with that for almost three days, neither Google or Stack Overflow has an anwser.</p> <p>I've tried to run the command and add another <code>shell_exec(passphrase)</code> also, passing passphrase and "y" twice this way.</p> <pre><code>shell_exec("openssl....","passphrase","y","y") </code></pre> <p>Thank you very much, i appreciate all help.</p> </div>

Mac OSX cmd从命令行工作,从php shell_exec()失败

<div class="post-text" itemprop="text"> <p>I am on Mac OS X 10.9.4</p> <p>I can run this command successfully from the command line to produce an image or</p> <pre><code>wkhtmltoimage /Users/me/Sites/google.jpg </code></pre> <p>But when I tried to execute the same command from inside my website using the php command</p> <pre><code>$cmd='wkhtmltoimage /Users/me/Sites/google.jpg'; shell_exec($cmd); </code></pre> <p>I get the following error:</p> <pre><code>sh: wkhtmltoimage: command not found </code></pre> <p>Is this a permission issue? If so how can I get it to work?</p> <p>====</p> <h1>Update</h1> <p>I set the full path like @Mureinik suggested and I made some progress now the error message I get is</p> <pre><code>Loading page (1/2) [&gt; ] 0% [======&gt; ] 10% [=============&gt; ] 23% [==================&gt; ] 31% [===================&gt; ] 33% [========================&gt; ] 41% [=====================================&gt; ] 62% [=======================================&gt; ] 65% [========================================&gt; ] 67% [=========================================&gt; ] 69% [==========================================&gt; ] 71% [==============================================&gt; ] 78% [==================================================&gt; ] 84% [===================================================&gt; ] 86% [============================================================] 100% Rendering (2/2) [&gt; ] 0% [===============&gt; ] 25% Error: Could not write to output file Error: Could not save image [============================================================] 100% Done Exit with code 1, due to unknown error. </code></pre> <p>Am I having a permission issue now?</p> <p>====</p> <h1>Update</h1> <p>I changed the file permission to my destination and that took care of it.</p> </div>


<div class="post-text" itemprop="text"> <p>Hi so i am wondering if somebody can offer me a solution..</p> <p>I have multiple instances of a php script i would like to run at once, I can semi achieve this using shell_exec() and not waiting for a response apart from the pid. This works wonderfully. However when doing this with the method below it works well for 100 or so executes but I need it to execute around 1000 times and it is taking too long to loop around the foreach and execute 1 by one.</p> <p>Example:</p> <pre><code> $items = $array(daatabase entries); foreach($items as $i){ $pid = shell_exec("execute the process.php"); } </code></pre> <p>Now assuming there are &lt; 100 this will take around 1 second or so to exec which is OK however i need to run loads of these and this will take 10-20 seconds.</p> <p>Is there any way of sending the commands in bulk rather than 1 at a time?</p> <p>Thanks</p> </div>


<div class="post-text" itemprop="text"> <p>I am uploading a file via php <code>move_uploaded_file</code> function and then the file is then taken as a parameter of a java program. while the java program is executing, it outputs the progress in the terminal. The output of the java program is input of a perl script which does the same. I am executing all of them in my php web site as shell_exec functions and printing them on screen</p> <pre><code> echo "Running java ..... "; $output=shell_exec("java -jar abc.jar ".( $_FILES['uploaded']['name'])); echo "&lt;pre&gt;$output&lt;/pre&gt;"; echo "running perl ....."; $output=shell_exec("perl outputfromjava.txt"); echo "&lt;pre&gt;$output&lt;/pre&gt;"; </code></pre> <p>The shell commands are running fine but the output from java and perl isn't displayed on my web site. I tried refreshing the page in my code after java and perl is executed but it then refreshes the upload too.</p> <p>The output is now</p> <pre><code>Running java .... Running Perl .... </code></pre> <p>How should I write my php so that the output is</p> <pre><code>Running Java... Progress1 //from java output progress2 //from java output Running Perl.... Progress1 //from perl output progress2 //from perl output </code></pre> <p>Thanks</p> </div>

PHP exec输出不返回并执行命令

<div class="post-text" itemprop="text"> <p>I am trying to execute a command in PHP on a Windows Server Machine.</p> <p>The code i am using is:</p> <pre><code>&lt;?php $out = array(); exec('C:\libs\bin\youtube-dl -o "C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw" ""', $out); print_r($out); ?&gt; </code></pre> <p>My result in PHP is:</p> <pre><code>Array ( [0] =&gt; [youtube] SrMKY5Aoyrw: Downloading webpage [1] =&gt; [youtube] SrMKY5Aoyrw: Downloading video info webpage [2] =&gt; [youtube] SrMKY5Aoyrw: Extracting video information [3] =&gt; [youtube] SrMKY5Aoyrw: Downloading DASH manifest [4] =&gt; [youtube] SrMKY5Aoyrw: Downloading DASH manifest ) </code></pre> <p>My result should be:</p> <pre><code>C:\xampp\htdocs\API\jbb15\convert&gt;C:\libs\bin\youtube-dl -o "C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw" "" [youtube] SrMKY5Aoyrw: Downloading webpage [youtube] SrMKY5Aoyrw: Downloading video info webpage [youtube] SrMKY5Aoyrw: Extracting video information [youtube] SrMKY5Aoyrw: Downloading DASH manifest [youtube] SrMKY5Aoyrw: Downloading DASH manifest WARNING: Requested formats are incompatible for merge and will be merged into mkv. [download] Destination: C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw.f137 [download] 100% of 111.72MiB in 00:01 [download] Destination: C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw.f251 [download] 100% of 8.13MiB in 00:00 [ffmpeg] Merging formats into "C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw.mkv" Deleting original file C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw.f137 (pass -k to keep) Deleting original file C:\xampp\htdocs\API\jbb15\convert\SrMKY5Aoyrw.f251 (pass -k to keep) </code></pre> <p>The problem about this is: The exact same command as in the above PHP script works perfectly if the command is copied into the Windows CMD. There are no PHP error logs. The command --verbose will return nothing in PHP, but works in windows cmd.</p> </div>

php 通过cmd可以执行php程序,但使用exec()时报错:Could not open input file?

想通过php cil实现异步发送邮件的功能。 在测试的时候,通过cmd命令行接口执行php时显示发送成功,如图:![图片说明]( 但是通过php的exec()函数执行cmd指令的时候报如下错误: ``` Could not open input file: E:\wamp\www\jpg\PHP_MYSQL ``` ![图片说明]( 如下是相关代码: ``` echo exec("E:\wamp\bin\php\php5.5.12\php.exe E:\wamp\www\jpg\PHP_MYSQL\testMail.php"); echo "<br/>done"; ``` 本人用的是wamp,另外,php的环境变量已经配置好了,不知道为什么报这个错误,希望php大佬帮忙看一下,感谢!


<div class="post-text" itemprop="text"> <p>I have a php script that creates a shell script which is run after making it from the same php file, the shell script generates a registry file that I need to read after the script is executed, again from the same php. The php reads the file, but I think it does it before the file is filled or created, if I go back at the browser and execute the php again, then there is content at the textarea. I have tried to solve it adding sleep(), exit() functions and some other strategies but no success. Here are some of the things I've tried:</p> <pre><code>// Creation of the shell script: Corpus alignment target to origin ...... $cmd = "cwb-align-encode -r $REGDIR -D $CORPUSLOCATION$corpusname/$corpusname"._."$lang_tg.align "; file_put_contents($scriptfile, $cmd, FILE_APPEND | LOCK_EX); // Run the corpus indexation script $cmd = "/bin/bash $scriptfile &gt; /dev/null 2&gt;&amp;1 &amp;"; shell_exec($cmd); </code></pre> <p>Read the registry file from the same php:</p> <pre><code>// 1st try: no content at the textarea echo "&lt;textarea id='txtArea'&gt;".htmlspecialchars(file_get_contents( $REGDIR.$corpusname ))."&lt;/textarea&gt;"; // 2nd try: no content at the textarea echo "&lt;textarea id='txtArea'&gt;".sleep(10); htmlspecialchars(file_get_contents( $REGDIR.$corpusname ))."&lt;/textarea&gt;"; // 3rd try: no content at the textarea echo "&lt;textarea id='txtArea'&gt;".exit(); htmlspecialchars(file_get_contents( $REGDIR.$corpusname ))."&lt;/textarea&gt;"; // 4th try: no content at the textarea echo "&lt;textarea id='txtArea'&gt;".if(filesize($REGDIR.$corpusname) != 0) { echo htmlspecialchars(file_get_contents( $REGDIR.$corpusname )); } else { exit(0); sleep(10); htmlspecialchars(file_get_contents( $REGDIR.$corpusname )); }."&lt;/textarea&gt;"; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I am using Go to create a CLI. I am executing a command and if there is an error thrown from the OS I want to print it.</p> <pre><code>cmd := exec.Command("abc", "run", pathToFile) err := cmd.Start() if err != nil { fmt.Printf("Error : %v ", err) os.Exit(1) } err = cmd.Wait() if err != nil { fmt.Printf("Error: %v ", err) os.Exit(1) } </code></pre> <p>This only gives me the exit status code</p> <pre><code>Error: exit status 1 </code></pre> <p>This is not descriptive enough.</p> <p>When I run the command directly in terminal I get the error message clearly.</p> <pre><code>source does not exist 'test.exe' </code></pre> <p>Is there a way to print the message?</p> </div>

我可以从命令行运行curl但不能从shell exec调用

<div class="post-text" itemprop="text"> <p>I want to use <code>shell_exec</code> to run <code>curl</code> and get the response. The problem is that my shell exec command doesn't work when I run <code>curl</code>, it works fine when I run <code>curl</code> in <code>cmd</code> or <code>cygwin</code>. I'm using laravel 5.6 with php 7.2</p> <p>I can run: </p> <blockquote> <p>shell_exec("ping");</p> </blockquote> <p>It return response like it has used to.</p> <p>But I can't run:</p> <blockquote> <p>shell_exec("curl some thing here");</p> </blockquote> <p>It gives me <code>null</code> when I use <code>dd()</code> or blank when I <code>print_r()</code>.</p> <ul> <li>My curl version 7.61 windows 10 64bit, open ssl 1.1.0i</li> <li>Already set path system variable on environment</li> </ul> <p>I know I can use guzzle, but I am just wondering why it doesn't work.</p> </div>


<div class="post-text" itemprop="text"> <p>I got some problem while using php to execute command line.</p> <p>I have a software and I need to execute the software to export pdf by using cmd command line. </p> <p>(The software need to be executed by using command-line)</p> <p>Therefore i wrote a php code.</p> <pre><code>&lt;?php $cmd ='C:\XmlServer.exe C:\input.xml'; shell_exec($cmd); ?&gt; </code></pre> <p>I've tried the string 'C:\XmlServer.exe C:\input.xml' is working on cmd.</p> <p>But I can't using php to execute command line to get the same result.</p> <p>I also tried <code>exec($cmd);</code>, but it still didn't work.</p> <p>Could anyone help me solving the problem?</p> <p>I want to run php just like running command line.</p> <p>I wrote like the following in command line:</p> <pre><code>C:\&gt; XmlServer.exe input.xml </code></pre> <p>then it's ok to output a file for me. but using the same code in php didn't work.</p> <p>-- Update </p> <p>using <code>echo shell_exec($cmd);</code> is okay, but no output.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm developing a web app where users will supply UTF8 text that will be rendered onto images using imagemagik. I'm calling the convert command through PHP's shell execute command.</p> <p>I'm not well versed on sanitizing user input (for injection) for command line operations and have been having trouble finding resources about my exact situation.</p> <p>The following article sounds like I don't have much to worry about if the user input is entirely enclosed in quotes in the bash command:</p> <p><a href="">Sanitize user input in bash for security purposes</a></p> <p>So my question is, what do I need to worry about for user sanitation/escaping in the following usage</p> <pre><code> &lt;?php //GET USER SUPPLIED POST DATA $user_input = $_POST['text']; //CALL IMAGEMAGIK VIA COMMAND LINE TO RENDER IMAGE exec("convert -pointsize 50 -draw 'text 50,50 \"".$user_input."\" ' /source.png /output.png"); </code></pre> <p>EDIT: Since posting I realized I should just be running imagemagick as an installed library in php... so now I guess, same question, but using the php object methods.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to create an interactive website that can open game servers and stop them for personal use, (and some close friends). I am trying to get a server to start on my linux machine, output the real-time results of the log file to the browser, and be able to stop the process and the output. I'm running into a problem where the output will load, but when i click on the button to stop the server/php script, it will continue to wait for another line to display. Once another line is displayed, everything works normally and the process is ended on the linux machine and the php script is stopped. Currently I am forced to ssh into my linux box, and append something to the log file to get the script to stop and the server processes to end. </p> <p>What can i do to fit these needs? I have also noticed i am unable to access any other page while the php script is running, is there a fix for this? Below are some things i have tried. I also need to be able to pass commands to the process to control the server through the web browser. I am using the apache2 web server.</p> <p>Example 1:</p> <pre><code> &lt;?php session_start(); if (isset($_POST['test'])) { shell_exec('pkill -f ./starbound_server'); $continueLoop = false; } ?&gt; &lt;!DOCTYPE html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post"&gt; &lt;p&gt; &lt;button name="test"&gt;Run ctl+c&lt;/button&gt; &lt;/p&gt; &lt;/form&gt; &lt;?php if (!isset($_POST['test'])) { shell_exec('cd /home/steam/steaamcmd/STEAM/starbound/linux64/ &amp;&amp; ./starbound_server &gt; /var/www/html/sb.txt &amp;'); //shell_exec('ping &gt; sb.txt &amp;'); set_time_limit(0); } //$file = fopen('test.txt', 'r') or die("UNABLE TO OPEN"); //echo nl2br(fread($file, filesize("test.txt"))); function follow($file) { $continueLoop = true; $size = 0; while ($continueLoop) { clearstatcache(); $currentSize = filesize($file); if ($size == $currentSize) { sleep(.3); continue; } $fh = fopen($file, "r"); fseek($fh, $size); while ($d = fgets($fh)) { echo "$d &lt;br&gt;"; } fclose($fh); $size = $currentSize; if (isset($_POST['test'])) { $continueLoop = false; } //if (!isset($firstRun)) { // echo "&lt;br&gt;&lt;br&gt;First Run&lt;br&gt;&lt;br&gt;"; // $firstRun = "ran"; //} flush(); ob_flush(); } } if (!isset($_POST['test'])) { follow("/var/www/html/sb.txt"); } else { echo "Processes terminated"; } ?&gt; </code></pre> <p>Example 2:</p> <pre><code>&lt;?php session_start(); if (isset($_POST['test'])) { flush(); ob_flush(); shell_exec('pkill -f ./starbound_server'); $continueLoop = false; } ?&gt; &lt;!DOCTYPE html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post"&gt; &lt;p&gt; &lt;button name="test"&gt;Run ctl+c&lt;/button&gt; &lt;/p&gt; &lt;/form&gt; &lt;?php if (!isset($_POST['test'])) { shell_exec('cd /home/steam/steaamcmd/STEAM/starbound/linux64/ &amp;&amp; ./starbound_server &gt; /var/www/html/sb.txt &amp;'); $handle = popen("tail -f /var/www/html/sb.txt 2&gt;&amp;1", 'r'); while(!feof($handle)) { flush(); ob_flush(); $buffer = fgets($handle); echo "$buffer "; echo "TEST"; flush(); ob_flush(); } pclose($handle); } else { shell_exec("echo 'end' &gt;&gt; /var/www/html/sb.txt"); echo "closed"; } ?&gt; </code></pre> <p>Example 3:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $cmd = "cd /home/steam/steaamcmd/STEAM/starbound/linux64/ &amp;&amp; ./starbound_server"; $descriptorspec = array( 0 =&gt; array("pipe", "r"), // stdin is a pipe that the child will read from 1 =&gt; array("pipe", "w"), // stdout is a pipe that the child will write to 2 =&gt; array("pipe", "w") // stderr is a pipe that the child will write to ); flush(); ob_implicit_flush(true); ob_end_flush(); $process = proc_open($cmd, $descriptorspec, $pipes, realpath('./'), array()); echo "&lt;pre&gt;"; if (is_resource($process)) { while ($s = fgets($pipes[1])) { print $s; flush(); } } echo "&lt;/pre&gt;"; proc_close($process); ?&gt; &lt;/body&gt; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I am trying to print php generated page using <a href="" rel="nofollow noreferrer">2Printer</a>(Free Version) from <a href="" rel="nofollow noreferrer"></a>. I used the following codes to do the task:</p> <pre><code>&lt;?php exec("2Printer.exe -s 'text.php' -alert_no"); //shell_exec("2Printer.exe -s 'text.php' -alert_no"); //system("2Printer.exe -s 'text.php' -alert_no"); </code></pre> <p>None of the above codes work and does not output any errors as well. I tried it with a text file (.txt), still it is not working. But from the normal command window (cmd), the printing is working. Is there anyone having experience with 2printer, please help. </p> </div>


<div class="post-text" itemprop="text"> <p><strong>What I need to do</strong> : I need to launch three commands from an index.php file in the navigator in a shell without blocking the navigator on each command but each command need to wait for the previous one to finish to be able to start.</p> <p><strong>What I tried</strong> (used the first note from this link <a href="" rel="nofollow noreferrer"></a>) : </p> <pre><code>$launchGeneration = function ($appName, $id_application) { $cmd = "gradlew assembleDebug &amp;&amp; cd ../../../api2 &amp;&amp; php scriptUpdate.php " . $id_application; chdir("../api/tmp/" . $appName . "/"); if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ". $cmd, "r")); } else { exec($cmd . " &gt; /dev/null &amp;"); } exec($cmd); }; </code></pre> <p>With this method, the navigator won't wait for the commands to finish but the problem is that I also need the first command to be finish before the others can start. The first one will build an application and only then the third one will modify some data in my database to change the status of the compilation from "waiting" to "done". But in this case, the status will be changed to "done" before the end of the build.</p> <p>At the moment I am working on Windows but in the end, it will be running on a unix system. If it can't be done with Windows I can switch with debian.</p> <p>Is there any way to launch several commands one by one without blocking the navigator ?</p> </div>


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...


何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...


文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...


今天下午在朋友圈看到很多人都在发github的羊毛,一时没明白是怎么回事。 后来上百度搜索了一下,原来真有这回事,毕竟资源主义的羊毛不少啊,1000刀刷爆了朋友圈!不知道你们的朋友圈有没有看到类似的消息。 这到底是啥情况? 微软开发者平台GitHub 的一个区块链项目 Handshake ,搞了一个招募新会员的活动,面向GitHub 上前 25万名开发者派送 4,246.99 HNS币,大约价...


跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...



技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...


华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...


loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...


刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...





总结了 150 余个神奇网站,你不来瞅瞅吗?



提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...




如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...






本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...




当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...






爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4


编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?